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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ScriptHeuristic.LongAccessor
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested 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.String
NAME
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description ScriptHeuristic(StreamInput in)
Read from a stream.ScriptHeuristic(Script script)
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object obj)
double
getScore(long subsetFreq, long subsetSize, long supersetFreq, long supersetSize)
Calculates score with a scriptjava.lang.String
getWriteableName()
Returns the name of the writeable objectint
hashCode()
static SignificanceHeuristic
parse(XContentParser parser)
SignificanceHeuristic
rewrite(InternalAggregation.ReduceContext context)
Provides a hook for subclasses to provide a version of the heuristic prepared for execution on data on the coordinating node.SignificanceHeuristic
rewrite(SearchContext context)
Provides a hook for subclasses to provide a version of the heuristic prepared for execution on data on a shard.XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params builderParams)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.-
Methods inherited from class org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic
checkFrequencyValidity
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ScriptHeuristic
public ScriptHeuristic(Script script)
-
ScriptHeuristic
public ScriptHeuristic(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
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
public SignificanceHeuristic rewrite(InternalAggregation.ReduceContext context)
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 classSignificanceHeuristic
- Parameters:
context
- the reduce context on the coordinating node- Returns:
- a version of this heuristic suitable for execution
-
rewrite
public SignificanceHeuristic rewrite(SearchContext context)
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 classSignificanceHeuristic
- Parameters:
context
- the search 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 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: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 classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
parse
public static SignificanceHeuristic parse(XContentParser parser) throws java.io.IOException, QueryShardException
- Throws:
java.io.IOException
QueryShardException
-
-