Class ScriptHeuristic

java.lang.Object
org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic
org.elasticsearch.search.aggregations.bucket.significant.heuristics.ScriptHeuristic
All Implemented Interfaces:
NamedWriteable, Writeable, ToXContent, ToXContentFragment

public class ScriptHeuristic
extends SignificanceHeuristic
  • Field Details

  • Constructor Details

  • Method Details

    • writeTo

      public void writeTo​(StreamOutput out) throws java.io.IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Throws:
      java.io.IOException
    • rewrite

      Description copied from class: SignificanceHeuristic
      Provides a hook for subclasses to provide a version of the heuristic prepared for execution on data on the coordinating node.
      Overrides:
      rewrite in class SignificanceHeuristic
      Parameters:
      context - the reduce context on the coordinating node
      Returns:
      a version of this heuristic suitable for execution
    • rewrite

      public SignificanceHeuristic rewrite​(QueryShardContext queryShardContext)
      Description copied from class: SignificanceHeuristic
      Provides a hook for subclasses to provide a version of the heuristic prepared for execution on data on a shard.
      Overrides:
      rewrite in class SignificanceHeuristic
      Parameters:
      queryShardContext - the shard context on the data node
      Returns:
      a version of this heuristic suitable for execution
    • getScore

      public double getScore​(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize)
      Calculates score with a script
      Specified by:
      getScore in class SignificanceHeuristic
      Parameters:
      subsetFreq - The frequency of the term in the selected sample
      subsetSize - The size of the selected sample (typically number of docs)
      supersetFreq - The frequency of the term in the superset from which the sample was taken
      supersetSize - The size of the superset from which the sample was taken (typically number of docs)
      Returns:
      a "significance" score
    • getWriteableName

      public java.lang.String getWriteableName()
      Description copied from interface: NamedWriteable
      Returns the name of the writeable object
    • toXContent

      public XContentBuilder toXContent​(XContentBuilder builder, ToXContent.Params builderParams) throws java.io.IOException
      Throws:
      java.io.IOException
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object