Class CommonTermsQueryBuilder

org.elasticsearch.index.query.AbstractQueryBuilder<CommonTermsQueryBuilder>
org.elasticsearch.index.query.CommonTermsQueryBuilder
All Implemented Interfaces:
NamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject, QueryBuilder, Rewriteable<QueryBuilder>

public class CommonTermsQueryBuilder extends AbstractQueryBuilder<CommonTermsQueryBuilder>
Deprecated.
Since max_optimization optimization landed in 7.0, normal MatchQuery will achieve the same result without any configuration.
CommonTermsQuery query is a query that executes high-frequency terms in a optional sub-query to prevent slow queries due to "common" terms like stopwords. This query basically builds 2 queries off the #add(Term) added terms where low-frequency terms are added to a required boolean clause and high-frequency terms are added to an optional boolean clause. The optional clause is only executed if the required "low-frequency' clause matches.
  • Field Details

    • COMMON_TERMS_QUERY_DEPRECATION_MSG

      public static final  COMMON_TERMS_QUERY_DEPRECATION_MSG
      Deprecated.
      See Also:
      Constant Field Values
    • NAME

      public static final  NAME
      Deprecated.
      See Also:
      Constant Field Values
    • DEFAULT_CUTOFF_FREQ

      public static final float DEFAULT_CUTOFF_FREQ
      Deprecated.
      See Also:
      Constant Field Values
    • DEFAULT_HIGH_FREQ_OCCUR

      public static final Operator DEFAULT_HIGH_FREQ_OCCUR
      Deprecated.
    • DEFAULT_LOW_FREQ_OCCUR

      public static final Operator DEFAULT_LOW_FREQ_OCCUR
      Deprecated.
    • DEFAULT_DISABLE_COORD

      public static final boolean DEFAULT_DISABLE_COORD
      Deprecated.
      See Also:
      Constant Field Values
  • Constructor Details

    • CommonTermsQueryBuilder

      public CommonTermsQueryBuilder( fieldName,  text)
      Deprecated.
      See CommonTermsQueryBuilder for more details.
      Constructs a new common terms query.
    • CommonTermsQueryBuilder

      public CommonTermsQueryBuilder(StreamInput in) throws
      Deprecated.
      See CommonTermsQueryBuilder for more details.
      Read from a stream.
      Throws:
  • Method Details

    • doWriteTo

      protected void doWriteTo(StreamOutput out) throws
      Deprecated.
      Specified by:
      doWriteTo in class AbstractQueryBuilder<CommonTermsQueryBuilder>
      Throws:
    • fieldName

      public  fieldName()
      Deprecated.
    • value

      public  value()
      Deprecated.
    • highFreqOperator

      public CommonTermsQueryBuilder highFreqOperator(Operator operator)
      Deprecated.
      Sets the operator to use for terms with a high document frequency (greater than or equal to cutoffFrequency(float). Defaults to AND.
    • highFreqOperator

      public Operator highFreqOperator()
      Deprecated.
    • lowFreqOperator

      public CommonTermsQueryBuilder lowFreqOperator(Operator operator)
      Deprecated.
      Sets the operator to use for terms with a low document frequency (less than cutoffFrequency(float). Defaults to AND.
    • lowFreqOperator

      public Operator lowFreqOperator()
      Deprecated.
    • analyzer

      public  analyzer)
      Deprecated.
      Explicitly set the analyzer to use. Defaults to use explicit mapping config for the field, or, if not set, the default search analyzer.
    • analyzer

      public  analyzer()
      Deprecated.
    • cutoffFrequency

      public CommonTermsQueryBuilder cutoffFrequency(float cutoffFrequency)
      Deprecated.
      Sets the cutoff document frequency for high / low frequent terms. A value in [0..1] (or absolute number >=1) representing the maximum threshold of a terms document frequency to be considered a low frequency term. Defaults to {@value #DEFAULT_CUTOFF_FREQ}
    • cutoffFrequency

      public float cutoffFrequency()
      Deprecated.
    • highFreqMinimumShouldMatch

      public  highFreqMinimumShouldMatch)
      Deprecated.
      Sets the minimum number of high frequent query terms that need to match in order to produce a hit when there are no low frequent terms.
    • highFreqMinimumShouldMatch

      public  highFreqMinimumShouldMatch()
      Deprecated.
    • lowFreqMinimumShouldMatch

      public  lowFreqMinimumShouldMatch)
      Deprecated.
      Sets the minimum number of low frequent query terms that need to match in order to produce a hit.
    • lowFreqMinimumShouldMatch

      public  lowFreqMinimumShouldMatch()
      Deprecated.
    • doXContent

      protected void doXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Deprecated.
      Specified by:
      doXContent in class AbstractQueryBuilder<CommonTermsQueryBuilder>
      Throws:
    • fromXContent

      public static CommonTermsQueryBuilder fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws
      Deprecated.
      Throws:
    • getWriteableName

      public  getWriteableName()
      Deprecated.
      Description copied from interface: NamedWriteable
      Returns the name of the writeable object
    • doToQuery

      protected org.apache.lucene.search.Query doToQuery(SearchExecutionContext context) throws
      Deprecated.
      Specified by:
      doToQuery in class AbstractQueryBuilder<CommonTermsQueryBuilder>
      Throws:
    • doHashCode

      protected int doHashCode()
      Deprecated.
      Specified by:
      doHashCode in class AbstractQueryBuilder<CommonTermsQueryBuilder>
    • doEquals

      protected boolean doEquals(CommonTermsQueryBuilder other)
      Deprecated.
      Description copied from class: AbstractQueryBuilder
      Indicates whether some other QueryBuilder object of the same type is "equal to" this one.
      Specified by:
      doEquals in class AbstractQueryBuilder<CommonTermsQueryBuilder>