1. Docs

Match Query

A match query returns documents that match a provided text, number, or boolean value. The provided text is analyzed before matching.

The match query is the standard query for performing a full-text search.

Parameters

  • field

    (Required, object) Field you wish to search. You can simplify the match query syntax by combining the field and query parameters.

  • query

    (Required) Text, number, or boolean value you wish to find in the provided field.

    The match query analyzes any provided text before performing a search. This means the match query can search text fields for analyzed tokens rather than an exact term.

  • operator

    (Optional, string) Boolean logic used to interpret text in the query value. Valid values are:

    • OR (Default)

      For example, a query value of capital of Hungary is interpreted as capital OR of OR Hungary.

    • AND

      For example, a query value of capital of Hungary is interpreted as capital AND of AND Hungary.

  • minimum_should_match

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

  • zero_terms_query (Optional, string) Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. Valid values are:

    • none (Default) No documents are returned if the analyzer removes all tokens.
    • all Returns all documents, similar to a match_all query.

Example

JSON
{ "query": { "match": { "message": { "query": "this is a test", "operator": "and" } } } }

Was this page helpful?