Class MoreLikeThisQuery.Builder

All Implemented Interfaces:
CopyableBuilder<MoreLikeThisQuery.Builder,MoreLikeThisQuery>, MutableBuilder<MoreLikeThisQuery.Builder,MoreLikeThisQuery>, ObjectBuilder<MoreLikeThisQuery>
Enclosing class:
MoreLikeThisQuery

Builder for MoreLikeThisQuery.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • copy

      @Nonnull public MoreLikeThisQuery.Builder copy()
      Description copied from interface: CopyableBuilder
      Create a new builder CopyableBuilder that is a copy of this one.
      Specified by:
      copy in interface CopyableBuilder<MoreLikeThisQuery.Builder,MoreLikeThisQuery>
      Returns:
      a new builder instance.
    • self

      @Nonnull protected MoreLikeThisQuery.Builder self()
      Specified by:
      self in class QueryBase.AbstractBuilder<MoreLikeThisQuery.Builder>
    • analyzer

      @Nonnull public final MoreLikeThisQuery.Builder analyzer(@Nullable String value)
      The analyzer that is used to analyze the free form text. Defaults to the analyzer associated with the first field in fields.

      API name: analyzer

    • boostTerms

      @Nonnull public final MoreLikeThisQuery.Builder boostTerms(@Nullable Float value)
      Each term in the formed query could be further boosted by their tf-idf score. This sets the boost factor to use when using this feature. Defaults to deactivated (0).

      API name: boost_terms

    • failOnUnsupportedField

      @Nonnull public final MoreLikeThisQuery.Builder failOnUnsupportedField(@Nullable Boolean value)
      Controls whether the query should fail (throw an exception) if any of the specified fields are not of the supported types (text or keyword).

      API name: fail_on_unsupported_field

    • fields

      @Nonnull public final MoreLikeThisQuery.Builder fields(List<String> list)
      A list of fields to fetch and analyze the text from. Defaults to the index.query.default_field index setting, which has a default value of *.

      API name: fields

      Adds all elements of list to fields.

    • fields

      @Nonnull public final MoreLikeThisQuery.Builder fields(String value, String... values)
      A list of fields to fetch and analyze the text from. Defaults to the index.query.default_field index setting, which has a default value of *.

      API name: fields

      Adds one or more values to fields.

    • include

      @Nonnull public final MoreLikeThisQuery.Builder include(@Nullable Boolean value)
      Specifies whether the input documents should also be included in the search results returned.

      API name: include

    • like

      @Nonnull public final MoreLikeThisQuery.Builder like(List<Like> list)
      Required - Specifies free form text and/or a single or multiple documents for which you want to find similar documents.

      API name: like

      Adds all elements of list to like.

    • like

      @Nonnull public final MoreLikeThisQuery.Builder like(Like value, Like... values)
      Required - Specifies free form text and/or a single or multiple documents for which you want to find similar documents.

      API name: like

      Adds one or more values to like.

    • like

      Required - Specifies free form text and/or a single or multiple documents for which you want to find similar documents.

      API name: like

      Adds a value to like using a builder lambda.

    • maxDocFreq

      @Nonnull public final MoreLikeThisQuery.Builder maxDocFreq(@Nullable Integer value)
      The maximum document frequency above which the terms are ignored from the input document.

      API name: max_doc_freq

    • maxQueryTerms

      @Nonnull public final MoreLikeThisQuery.Builder maxQueryTerms(@Nullable Integer value)
      The maximum number of query terms that can be selected.

      API name: max_query_terms

    • maxWordLength

      @Nonnull public final MoreLikeThisQuery.Builder maxWordLength(@Nullable Integer value)
      The maximum word length above which the terms are ignored. Defaults to unbounded (0).

      API name: max_word_length

    • minDocFreq

      @Nonnull public final MoreLikeThisQuery.Builder minDocFreq(@Nullable Integer value)
      The minimum document frequency below which the terms are ignored from the input document.

      API name: min_doc_freq

    • minTermFreq

      @Nonnull public final MoreLikeThisQuery.Builder minTermFreq(@Nullable Integer value)
      The minimum term frequency below which the terms are ignored from the input document.

      API name: min_term_freq

    • minWordLength

      @Nonnull public final MoreLikeThisQuery.Builder minWordLength(@Nullable Integer value)
      The minimum word length below which the terms are ignored.

      API name: min_word_length

    • minimumShouldMatch

      @Nonnull public final MoreLikeThisQuery.Builder minimumShouldMatch(@Nullable String value)
      API name: minimum_should_match
    • perFieldAnalyzer

      @Nonnull public final MoreLikeThisQuery.Builder perFieldAnalyzer(Map<String,String> map)
      Overrides the default analyzer.

      API name: per_field_analyzer

      Adds all elements of map to perFieldAnalyzer.

    • perFieldAnalyzer

      @Nonnull public final MoreLikeThisQuery.Builder perFieldAnalyzer(String key, String value)
      Overrides the default analyzer.

      API name: per_field_analyzer

      Adds an entry to perFieldAnalyzer.

    • routing

      @Nonnull public final MoreLikeThisQuery.Builder routing(@Nullable String value)
      API name: routing
    • stopWords

      @Nonnull public final MoreLikeThisQuery.Builder stopWords(List<String> list)
      API name: stop_words

      Adds all elements of list to stopWords.

    • stopWords

      @Nonnull public final MoreLikeThisQuery.Builder stopWords(String value, String... values)
      API name: stop_words

      Adds one or more values to stopWords.

    • unlike

      @Nonnull public final MoreLikeThisQuery.Builder unlike(List<Like> list)
      Used in combination with like to exclude documents that match a set of terms.

      API name: unlike

      Adds all elements of list to unlike.

    • unlike

      @Nonnull public final MoreLikeThisQuery.Builder unlike(Like value, Like... values)
      Used in combination with like to exclude documents that match a set of terms.

      API name: unlike

      Adds one or more values to unlike.

    • unlike

      @Nonnull public final MoreLikeThisQuery.Builder unlike(Function<Like.Builder,ObjectBuilder<Like>> fn)
      Used in combination with like to exclude documents that match a set of terms.

      API name: unlike

      Adds a value to unlike using a builder lambda.

    • version

      @Nonnull public final MoreLikeThisQuery.Builder version(@Nullable Long value)
      API name: version
    • versionType

      @Nonnull public final MoreLikeThisQuery.Builder versionType(@Nullable VersionType value)
      API name: version_type
    • build

      @Nonnull public MoreLikeThisQuery build()
      Specified by:
      build in interface ObjectBuilder<MoreLikeThisQuery>
      Throws:
      NullPointerException - if some of the required fields are null.