Class TokenPruningConfig

java.lang.Object
org.elasticsearch.xpack.core.ml.search.TokenPruningConfig
All Implemented Interfaces:
Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class TokenPruningConfig extends Object implements Writeable, org.elasticsearch.xcontent.ToXContentObject
  • 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

      public TokenPruningConfig(StreamInput in) throws IOException
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      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). When true, only non-relevant tokens are considered for matching and scoring documents. Enabling this option is valuable for re-scoring top hits retrieved from another QueryBuilder with active thresholds.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • fromXContent

      public static TokenPruningConfig fromXContent(org.elasticsearch.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException