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