Package org.elasticsearch.script
Class AbstractFieldScript
java.lang.Object
org.elasticsearch.script.AbstractFieldScript
- Direct Known Subclasses:
AbstractLongFieldScript
,BooleanFieldScript
,DoubleFieldScript
,IpFieldScript
,StringFieldScript
Abstract base for scripts to execute to build scripted fields. Inspired by
AggregationScript
but hopefully with less historical baggage.-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected LeafSearchLookup
static int
The maximum number of values a script should be allowed to emit. -
Constructor Summary
ConstructorDescriptionAbstractFieldScript(String fieldName, Map<String,Object> params, SearchLookup searchLookup, org.apache.lucene.index.LeafReaderContext ctx)
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkMaxSize(int currentSize)
Check if the we can add another value to the list of values.protected abstract void
protected void
abstract void
execute()
extractFromSource(String path)
Map<String,ScriptDocValues<?>>
getDoc()
Expose field data to the script asdoc
.Expose theparams
of the script to the script itself.void
setDocument(int docId)
Set the document to run the script against.
-
Field Details
-
MAX_VALUES
public static final int MAX_VALUESThe maximum number of values a script should be allowed to emit.- See Also:
- Constant Field Values
-
fieldName
-
leafSearchLookup
-
-
Constructor Details
-
AbstractFieldScript
public AbstractFieldScript(String fieldName, Map<String,Object> params, SearchLookup searchLookup, org.apache.lucene.index.LeafReaderContext ctx)
-
-
Method Details
-
setDocument
public final void setDocument(int docId)Set the document to run the script against. -
getParams
Expose theparams
of the script to the script itself. -
getDoc
Expose field data to the script asdoc
. -
extractFromSource
-
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
-
execute
public abstract void execute()
-