Class AggregationScript

java.lang.Object
org.elasticsearch.script.DocBasedScript
org.elasticsearch.script.AggregationScript
All Implemented Interfaces:
ScorerAware

public abstract class AggregationScript extends DocBasedScript implements ScorerAware
  • Field Details

    • PARAMETERS

      public static final String[] PARAMETERS
    • CONTEXT

      public static final ScriptContext<AggregationScript.Factory> CONTEXT
    • scorer

      protected org.apache.lucene.search.Scorable scorer
      A 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

      public Map<String,Object> getParams()
      Return the parameters for this script.
    • setScorer

      public void setScorer(org.apache.lucene.search.Scorable scorer)
      Specified by:
      setScorer in interface ScorerAware
    • setNextAggregationValue

      public void setNextAggregationValue(Object value)
      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

      public Number get_score()
    • get_value

      public Object 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

      public abstract Object execute()