Class MoreLikeThisQuery.Builder

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

public static class MoreLikeThisQuery.Builder extends QueryBase.AbstractBuilder<MoreLikeThisQuery.Builder> implements ObjectBuilder<MoreLikeThisQuery>
Builder for MoreLikeThisQuery.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • analyzer

      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

      public final MoreLikeThisQuery.Builder boostTerms(@Nullable Double 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

      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

      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

      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

      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

      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

      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

      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

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

      API name: max_query_terms

    • maxWordLength

      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

      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

    • minimumShouldMatch

      public final MoreLikeThisQuery.Builder minimumShouldMatch(@Nullable String value)
      After the disjunctive query has been formed, this parameter controls the number of terms that must match.

      API name: minimum_should_match

    • minTermFreq

      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

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

      API name: min_word_length

    • perFieldAnalyzer

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

      API name: per_field_analyzer

      Adds all entries of map to perFieldAnalyzer.

    • perFieldAnalyzer

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

      API name: per_field_analyzer

      Adds an entry to perFieldAnalyzer.

    • routing

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

      public final MoreLikeThisQuery.Builder stopWords(List<String> list)
      An array of stop words. Any word in this set is ignored.

      API name: stop_words

      Adds all elements of list to stopWords.

    • stopWords

      public final MoreLikeThisQuery.Builder stopWords(String value, String... values)
      An array of stop words. Any word in this set is ignored.

      API name: stop_words

      Adds one or more values to stopWords.

    • unlike

      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

      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

      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

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

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

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

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