java.lang.Object
org.elasticsearch.script.DocBasedScript
org.elasticsearch.script.AggregationScript
- All Implemented Interfaces:
ScorerAware
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A factory to construct statefulAggregationScript
factories for a specific index.static interface
A factory to constructAggregationScript
instances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ScriptContext<AggregationScript.Factory>
static final String[]
protected org.apache.lucene.search.Scorable
A 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
ConstructorsModifierConstructorDescriptionprotected
AggregationScript
(Map<String, Object> params, SearchLookup lookup, org.apache.lucene.index.LeafReaderContext leafContext) -
Method Summary
Modifier and TypeMethodDescriptionabstract Object
execute()
Return the parameters for this script.double
long
Return the result as a long.void
setNextAggregationValue
(Object value) Sets per-document aggregation_value
.void
setScorer
(org.apache.lucene.search.Scorable scorer) Methods inherited from class org.elasticsearch.script.DocBasedScript
docAsMap, field, fields, getDoc, setDocument
-
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:
setScorer
in 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
-