java.lang.Object
org.elasticsearch.script.DocBasedScript
org.elasticsearch.script.AggregationScript
- All Implemented Interfaces:
ScorerAware
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA factory to construct statefulAggregationScriptfactories for a specific index.static interfaceA factory to constructAggregationScriptinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ScriptContext<AggregationScript.Factory> static final String[]protected org.apache.lucene.search.ScorableA scorer that will return the score for the current document when the script is run.Fields inherited from class org.elasticsearch.script.DocBasedScript
docReader -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAggregationScript(Map<String, Object> params, SearchLookup lookup, org.apache.lucene.index.LeafReaderContext leafContext) -
Method Summary
Modifier and TypeMethodDescriptionabstract Objectexecute()Return the parameters for this script.doublelongReturn the result as a long.voidsetNextAggregationValue(Object value) Sets per-document aggregation_value.voidsetScorer(org.apache.lucene.search.Scorable scorer) Methods inherited from class org.elasticsearch.script.DocBasedScript
docAsMap, field, fields, getDoc, setDocument, source
-
Field Details
-
PARAMETERS
-
CONTEXT
-
scorer
protected org.apache.lucene.search.Scorable scorerA scorer that will return the score for the current document when the script is run.
-
-
Constructor Details
-
AggregationScript
public AggregationScript(Map<String, Object> params, SearchLookup lookup, org.apache.lucene.index.LeafReaderContext leafContext) -
AggregationScript
protected AggregationScript()
-
-
Method Details
-
getParams
Return the parameters for this script. -
setScorer
public void setScorer(org.apache.lucene.search.Scorable scorer) - Specified by:
setScorerin interfaceScorerAware
-
setNextAggregationValue
Sets per-document aggregation_value.The default implementation just calls
setNextVar("_value", value)but some engines might want to handle this differently for better performance.- Parameters:
value- per-document value, typically a String, Long, or Double
-
get_score
-
get_value
-
runAsLong
public long runAsLong()Return the result as a long. This is used by aggregation scripts over long fields. -
runAsDouble
public double runAsDouble() -
execute
-