Class ScriptHeuristic
java.lang.Object
org.elasticsearch.search.aggregations.bucket.terms.heuristic.SignificanceHeuristic
org.elasticsearch.search.aggregations.bucket.terms.heuristic.ScriptHeuristic
- All Implemented Interfaces:
NamedWriteable,Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
public class ScriptHeuristic extends SignificanceHeuristic
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classScriptHeuristic.LongAccessorNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAMEstatic org.elasticsearch.common.xcontent.ConstructingObjectParser<ScriptHeuristic,java.lang.Void>PARSER -
Constructor Summary
Constructors Constructor Description ScriptHeuristic(StreamInput in)Read from a stream.ScriptHeuristic(Script script) -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object obj)doublegetScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize)Calculates score with a scriptjava.lang.StringgetWriteableName()Returns the name of the writeable objectinthashCode()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 context)Provides a hook for subclasses to provide a version of the heuristic prepared for execution on data on the coordinating node.org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params builderParams)voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class org.elasticsearch.search.aggregations.bucket.terms.heuristic.SignificanceHeuristic
checkFrequencyValidity
-
Field Details
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
PARSER
public static final org.elasticsearch.common.xcontent.ConstructingObjectParser<ScriptHeuristic,java.lang.Void> PARSER
-
-
Constructor Details
-
ScriptHeuristic
-
ScriptHeuristic
Read from a stream.- Throws:
java.io.IOException
-
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Throws:
java.io.IOException
-
rewrite
Description copied from class:SignificanceHeuristicProvides a hook for subclasses to provide a version of the heuristic prepared for execution on data on the coordinating node.- Overrides:
rewritein classSignificanceHeuristic- Parameters:
context- the reduce context on the coordinating node- Returns:
- a version of this heuristic suitable for execution
-
rewrite
Description copied from class:SignificanceHeuristicProvides a hook for subclasses to provide a version of the heuristic prepared for execution on data on a shard.- Overrides:
rewritein classSignificanceHeuristic- 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:
getScorein classSignificanceHeuristic- 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
-
getWriteableName
public java.lang.String getWriteableName()Description copied from interface:NamedWriteableReturns the name of the writeable object -
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params builderParams) throws java.io.IOException- Throws:
java.io.IOException
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-