Class MultiMatchQueryBuilder

    • Constructor Detail

      • MultiMatchQueryBuilder

        public MultiMatchQueryBuilder​(java.lang.Object value,
                                      java.lang.String... fields)
        Constructs a new text query.
      • MultiMatchQueryBuilder

        public MultiMatchQueryBuilder​(StreamInput in)
                               throws java.io.IOException
        Read from a stream.
        Throws:
        java.io.IOException
    • Method Detail

      • value

        public java.lang.Object value()
      • field

        public MultiMatchQueryBuilder field​(java.lang.String field)
        Adds a field to run the multi match against.
      • field

        public MultiMatchQueryBuilder field​(java.lang.String field,
                                            float boost)
        Adds a field to run the multi match against with a specific boost.
      • fields

        public MultiMatchQueryBuilder fields​(java.util.Map<java.lang.String,​java.lang.Float> fields)
        Add several fields to run the query against with a specific boost.
      • fields

        public java.util.Map<java.lang.String,​java.lang.Float> fields()
      • analyzer

        public MultiMatchQueryBuilder analyzer​(java.lang.String analyzer)
        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 java.lang.String analyzer()
      • slop

        public MultiMatchQueryBuilder slop​(int slop)
        Set the phrase slop if evaluated to a phrase query type.
      • slop

        public int slop()
      • fuzziness

        public MultiMatchQueryBuilder fuzziness​(java.lang.Object fuzziness)
        Sets the fuzziness used when evaluated to a fuzzy query type. Defaults to "AUTO".
      • prefixLength

        public int prefixLength()
      • maxExpansions

        public MultiMatchQueryBuilder maxExpansions​(int maxExpansions)
        When using fuzzy or prefix type query, the number of term expansions to use. Defaults to unbounded so its recommended to set it to a reasonable value for faster execution.
      • maxExpansions

        public int maxExpansions()
      • minimumShouldMatch

        public MultiMatchQueryBuilder minimumShouldMatch​(java.lang.String minimumShouldMatch)
      • minimumShouldMatch

        public java.lang.String minimumShouldMatch()
      • fuzzyRewrite

        public java.lang.String fuzzyRewrite()
      • useDisMax

        public java.lang.Boolean useDisMax()
      • tieBreaker

        public MultiMatchQueryBuilder tieBreaker​(float tieBreaker)

        Tie-Breaker for "best-match" disjunction queries (OR-Queries). The tie breaker capability allows documents that match more than one query clause (in this case on more than one field) to be scored better than documents that match only the best of the fields, without confusing this with the better case of two distinct matches in the multiple fields.

        A tie-breaker value of 1.0 is interpreted as a signal to score queries as "most-match" queries where all matching query clauses are considered for scoring.

        See Also:
        MultiMatchQueryBuilder.Type
      • tieBreaker

        public MultiMatchQueryBuilder tieBreaker​(java.lang.Float tieBreaker)

        Tie-Breaker for "best-match" disjunction queries (OR-Queries). The tie breaker capability allows documents that match more than one query clause (in this case on more than one field) to be scored better than documents that match only the best of the fields, without confusing this with the better case of two distinct matches in the multiple fields.

        A tie-breaker value of 1.0 is interpreted as a signal to score queries as "most-match" queries where all matching query clauses are considered for scoring.

        See Also:
        MultiMatchQueryBuilder.Type
      • tieBreaker

        public java.lang.Float tieBreaker()
      • lenient

        public MultiMatchQueryBuilder lenient​(boolean lenient)
        Sets whether format based failures will be ignored.
      • lenient

        public boolean lenient()
      • cutoffFrequency

        public MultiMatchQueryBuilder cutoffFrequency​(float cutoff)
        Set a cutoff value in [0..1] (or absolute number >=1) representing the maximum threshold of a terms document frequency to be considered a low frequency term.
      • cutoffFrequency

        public MultiMatchQueryBuilder cutoffFrequency​(java.lang.Float cutoff)
        Set a cutoff value in [0..1] (or absolute number >=1) representing the maximum threshold of a terms document frequency to be considered a low frequency term.
      • cutoffFrequency

        public java.lang.Float cutoffFrequency()
      • autoGenerateSynonymsPhraseQuery

        public MultiMatchQueryBuilder autoGenerateSynonymsPhraseQuery​(boolean enable)
      • autoGenerateSynonymsPhraseQuery

        public boolean autoGenerateSynonymsPhraseQuery()
        Whether phrase queries should be automatically generated for multi terms synonyms. Defaults to true.
      • fuzzyTranspositions

        public boolean fuzzyTranspositions()
      • fuzzyTranspositions

        public MultiMatchQueryBuilder fuzzyTranspositions​(boolean fuzzyTranspositions)
        Sets whether transpositions are supported in fuzzy queries.

        The default metric used by fuzzy queries to determine a match is the Damerau-Levenshtein distance formula which supports transpositions. Setting transposition to false will switch to classic Levenshtein distance.
        If not set, Damerau-Levenshtein distance metric will be used.

      • getWriteableName

        public java.lang.String getWriteableName()
        Description copied from interface: NamedWriteable
        Returns the name of the writeable object