match

fun match(match: String, field: String = "_all", analyzer: String? = null, operator: SearchQuery.Companion.MatchOperator = MatchOperator.OR, fuzziness: Int = 0, prefixLength: Int = 0): SearchQuery

A Match query.

Analyzes match and uses the result to query the index.

Analysis means if the field is indexed with an appropriate language-specific analyzer, then "beauty" will match "beautiful", "swim" will match "swimming", etc.

The match input may contain multiple terms. By default, at least one of the terms must be present in the document. To require all terms be present, set operator to MatchOperator.AND. The order and position of the terms do not matter for this query.

Similar queries

If you want exact matches without analysis, use term.

If the order and position of the terms are significant, use matchPhrase.

Parameters

match

The input string to analyze and match against.

analyzer

Analyzer to apply to match. Defaults to the analyzer set for field during index creation.

field

The field to search. Defaults to _all, whose content is specified during index creation.

operator

Determines whether a match value of "location hostel" means "location AND hostel" or "location OR hostel".

fuzziness

Maximum allowable Levenshtein distance for a match against an analyzed term.

prefixLength

To be considered a match, an input term and the matched text must have a common prefix of this length.