Match query

Match query #

Returns documents that match a provided text, number, date or boolean value. The provided text is analyzed before matching — this is the primary full-text query.

Inside a nested query: supported — the text is matched per array element.

Examples #

POST /my-collection/_search
{
  "query": {
    "match": {
      "field": "message",
      "query": "this is a test"
    }
  }
}

The match query applies the field’s search analyzer (or analyzer when given) to the text, then matches the resulting tokens with OR semantics by default. Require all tokens with operator:

POST /my-collection/_search
{
  "query": {
    "match": {
      "field": "message",
      "query": "this is a test",
      "operator": "and"
    }
  }
}

Parameters for match #

  • <field>
    (Required, string) Field you wish to search.

  • query
    (Required, string) Text, number, boolean value or date you wish to find in the provided <field>.

  • analyzer
    (Optional, string) Analyzer used to convert the text in the query value into tokens. Defaults to the field’s search analyzer.

  • operator
    (Optional, string) Boolean logic used to interpret the text: or (default) or and.

  • minimum_should_match
    (Optional, string) Minimum number of clauses that must match for a document to be returned.

  • fuzziness
    (unsupported) Fuzzy matching inside match is not implemented. Setting fuzziness (a common Elasticsearch idiom) is rejected with HTTP 400 naming the parameter, rather than silently ignored — a body carrying it would otherwise run as an exact analyzed match, which is not what the writer intended. Use the fuzzy query or the query_string ~ operator instead:

    POST /my-collection/_search
    { "query": { "match": { "field": "title", "query": "hello", "fuzziness": "AUTO" } } }
    # 400 — match.fuzziness is not supported yet — use the `fuzzy` query
    #       (or the query_string `~` operator) instead
    
  • prefix_length
    (Optional, integer, default: 0) Number of beginning characters left unchanged for fuzzy matching.

  • max_expansions
    (Optional, integer, default: 50) Maximum number of terms to which the query expands.

  • fuzzy_transpositions
    (Optional, boolean, default: true) Edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).

  • auto_generate_synonyms_phrase_query
    (Optional, boolean, default: true) If true, match phrase queries are automatically created for multi-term synonyms.

  • lenient
    (Optional, boolean, default: false) If true, format-based errors (such as a text value for a numeric field) are ignored.

  • boost
    (Optional, float, default: 1.0) Decrease or increase the relevance scores of the query.

  • fuzzy_rewrite
    (Optional, string) Method used to rewrite the fuzzy expansion (constant_score, scoring_boolean, …).

  • zero_terms_query
    (Optional, string) What to match when the analyzer removes every token (e.g. a stop filter): none (default, matches nothing) or all.

  • cross_fields_strategy
    (Optional, string) Score combination used when matching across multiple analyzed fields: best_fields or most_fields.

Calendar September 30, 2026
Edit Edit this page