Module org.elasticsearch.xcore
Class TokenPruningConfig
java.lang.Object
org.elasticsearch.xpack.core.ml.search.TokenPruningConfig
- All Implemented Interfaces:
Writeable,org.elasticsearch.xcontent.ToXContent,org.elasticsearch.xcontent.ToXContentObject
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final floatstatic final floatstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionTokenPruningConfig(float tokensFreqRatioThreshold, float tokensWeightThreshold, boolean onlyScorePrunedTokens) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic TokenPruningConfigfromXContent(org.elasticsearch.xcontent.XContentParser parser) floatReturns the frequency ratio threshold to apply on the query.floatReturns the weight threshold to apply on the query.inthashCode()booleanReturns whether the filtering process retains tokens identified as non-relevant based on the specified thresholds (ratio and weight).org.elasticsearch.xcontent.XContentBuildertoXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) voidwriteTo(StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Field Details
-
TOKENS_FREQ_RATIO_THRESHOLD
public static final org.elasticsearch.xcontent.ParseField TOKENS_FREQ_RATIO_THRESHOLD -
TOKENS_WEIGHT_THRESHOLD
public static final org.elasticsearch.xcontent.ParseField TOKENS_WEIGHT_THRESHOLD -
ONLY_SCORE_PRUNED_TOKENS_FIELD
public static final org.elasticsearch.xcontent.ParseField ONLY_SCORE_PRUNED_TOKENS_FIELD -
DEFAULT_TOKENS_FREQ_RATIO_THRESHOLD
public static final float DEFAULT_TOKENS_FREQ_RATIO_THRESHOLD- See Also:
-
MAX_TOKENS_FREQ_RATIO_THRESHOLD
public static final float MAX_TOKENS_FREQ_RATIO_THRESHOLD- See Also:
-
DEFAULT_TOKENS_WEIGHT_THRESHOLD
public static final float DEFAULT_TOKENS_WEIGHT_THRESHOLD- See Also:
-
-
Constructor Details
-
TokenPruningConfig
public TokenPruningConfig() -
TokenPruningConfig
public TokenPruningConfig(float tokensFreqRatioThreshold, float tokensWeightThreshold, boolean onlyScorePrunedTokens) -
TokenPruningConfig
- Throws:
IOException
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getTokensFreqRatioThreshold
public float getTokensFreqRatioThreshold()Returns the frequency ratio threshold to apply on the query. Tokens whose frequency is more than ratio_threshold times the average frequency of all tokens in the specified field are considered outliers and may be subject to removal from the query. -
getTokensWeightThreshold
public float getTokensWeightThreshold()Returns the weight threshold to apply on the query. Tokens whose weight is more than (weightThreshold * best_weight) of the highest weight in the query are not considered outliers, even if their frequency exceeds the specified ratio_threshold. This threshold ensures that important tokens, as indicated by their weight, are retained in the query. -
isOnlyScorePrunedTokens
public boolean isOnlyScorePrunedTokens()Returns whether the filtering process retains tokens identified as non-relevant based on the specified thresholds (ratio and weight). Whentrue, only non-relevant tokens are considered for matching and scoring documents. Enabling this option is valuable for re-scoring top hits retrieved from anotherQueryBuilderwith active thresholds. -
equals
-
hashCode
public int hashCode() -
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.xcontent.ToXContent- Throws:
IOException
-
fromXContent
public static TokenPruningConfig fromXContent(org.elasticsearch.xcontent.XContentParser parser) throws IOException - Throws:
IOException
-