# MATCH

The MATCH function performs a match query on a specified field, similar to the `match` query in the Elasticsearch Query DSL. It can be used on fields such as text, semantic_text, keyword, boolean, dates, and numeric types. When used on a semantic_text field, it performs a semantic query. MATCH supports function named parameters for additional query options, and all match query parameters are supported. The function returns true if the provided query matches the row. For a simplified syntax, you can use the match operator `:` instead of MATCH.

## Syntax

`MATCH(field, query, options, fuzziness, auto_generate_synonyms_phrase_query, analyzer, minimum_should_match, zero_terms_query, boost, fuzzy_transpositions, fuzzy_rewrite, prefix_length, lenient, operator, max_expansions)`

### Parameters

#### field

The field that the query will target.

#### query

The value to find in the provided field.

#### options

Optional. Additional match options specified as function named parameters.

#### fuzziness

Maximum edit distance allowed for matching.

#### auto_generate_synonyms_phrase_query

Optional. If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.

#### analyzer

Optional. Analyzer used to convert the text in the query value into tokens. Defaults to the index-time analyzer mapped for the field, or the index’s default analyzer if none is mapped.

#### minimum_should_match

Optional. Minimum number of clauses that must match for a document to be returned.

#### zero_terms_query

Optional. Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.

#### boost

Optional. Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.

#### fuzzy_transpositions

Optional. If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.

#### fuzzy_rewrite

Optional. Method used to rewrite the query. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.

#### prefix_length

Optional. Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.

#### lenient

Optional. If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.

#### operator

Optional. Boolean logic used to interpret text in the query value. Defaults to OR.

#### max_expansions

Optional. Maximum number of terms to which the query will expand. Defaults to 50.

## Examples

Finds all books where the author field matches "Faulkner".
```esql
FROM books
| WHERE MATCH(author, "Faulkner")
```

Finds books whose title matches the phrase "Hobbit Back Again" using the AND operator, and returns only the title column.
```esql
FROM books
| WHERE MATCH(title, "Hobbit Back Again", {"operator": "AND"})
| KEEP title;
```