Class SignificanceHeuristic
java.lang.Object
org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentFragment
- Direct Known Subclasses:
JLHScore,NXYSignificanceHeuristic,PercentageScore,ScriptHeuristic
public abstract class SignificanceHeuristic extends java.lang.Object implements NamedWriteable, ToXContentFragment
Heuristic for that
SignificantTerms uses to pick out significant terms.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
-
Constructor Summary
Constructors Constructor Description SignificanceHeuristic() -
Method Summary
Modifier and Type Method Description protected voidcheckFrequencyValidity(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize, java.lang.String scoreFunctionName)abstract doublegetScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize)SignificanceHeuristicrewrite(QueryShardContext queryShardContext)Provides a hook for subclasses to provide a version of the heuristic prepared for execution on data on a shard.SignificanceHeuristicrewrite(InternalAggregation.ReduceContext reduceContext)Provides a hook for subclasses to provide a version of the heuristic prepared for execution on data on the coordinating node.
-
Constructor Details
-
SignificanceHeuristic
public SignificanceHeuristic()
-
-
Method Details
-
getScore
public abstract double getScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize)- Parameters:
subsetFreq- The frequency of the term in the selected samplesubsetSize- The size of the selected sample (typically number of docs)supersetFreq- The frequency of the term in the superset from which the sample was takensupersetSize- The size of the superset from which the sample was taken (typically number of docs)- Returns:
- a "significance" score
-
checkFrequencyValidity
protected void checkFrequencyValidity(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize, java.lang.String scoreFunctionName) -
rewrite
Provides a hook for subclasses to provide a version of the heuristic prepared for execution on data on the coordinating node.- Parameters:
reduceContext- the reduce context on the coordinating node- Returns:
- a version of this heuristic suitable for execution
-
rewrite
Provides a hook for subclasses to provide a version of the heuristic prepared for execution on data on a shard.- Parameters:
queryShardContext- the shard context on the data node- Returns:
- a version of this heuristic suitable for execution
-