java.lang.Object
org.elasticsearch.script.DocBasedScript
org.elasticsearch.script.AbstractFieldScript
- Direct Known Subclasses:
AbstractLongFieldScript
,BooleanFieldScript
,CompositeFieldScript
,DoubleFieldScript
,GeoPointFieldScript
,IpFieldScript
,StringFieldScript
Abstract base for scripts to execute to build scripted fields. Inspired by
AggregationScript
but hopefully with less historical baggage.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final String
static final int
The maximum number of values a script should be allowed to emit.Fields inherited from class org.elasticsearch.script.DocBasedScript
docReader
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractFieldScript
(String fieldName, Map<String, Object> params, SearchLookup searchLookup, org.apache.lucene.index.LeafReaderContext ctx, OnScriptError onScriptError) -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
checkMaxSize
(int currentSize) Check if the we can add another value to the list of values.protected final void
emitFromCompositeScript
(CompositeFieldScript compositeFieldScript) protected abstract void
protected final void
protected void
abstract void
execute()
extractFromSource
(String path) Expose theparams
of the script to the script itself.protected abstract void
final void
runForDoc
(int docId) Execute the script for the provideddocId
.Methods inherited from class org.elasticsearch.script.DocBasedScript
docAsMap, field, fields, getDoc, setDocument, source
-
Field Details
-
MAX_VALUES
public static final int MAX_VALUESThe maximum number of values a script should be allowed to emit.- See Also:
-
fieldName
-
source
-
-
Constructor Details
-
AbstractFieldScript
public AbstractFieldScript(String fieldName, Map<String, Object> params, SearchLookup searchLookup, org.apache.lucene.index.LeafReaderContext ctx, OnScriptError onScriptError)
-
-
Method Details
-
getParams
Expose theparams
of the script to the script itself. -
extractFromSource
-
emitFromCompositeScript
-
emitValueFromCompositeScript
-
emitFromObject
-
emitFromSource
protected final void emitFromSource() -
checkMaxSize
protected final void checkMaxSize(int currentSize) Check if the we can add another value to the list of values.- Parameters:
currentSize
- the current size of the list
-
prepareExecute
protected abstract void prepareExecute() -
runForDoc
public final void runForDoc(int docId) Execute the script for the provideddocId
. -
execute
public abstract void execute()
-