Multi-match query
/ Multi_match, / QueryMulti-match query #
Returns documents that match a provided text across several fields —
like the
match query, with per-field boosts and
multi-field scoring strategies.
Inside a
nestedquery: supported — fields under the nested path are matched per array element.
How it works #
multi_match is expanded before execution (Query::simplify) into a
tree the segment executors already know:
- Each entry in
fields— after splitting off a^boostsuffix — becomes onematchquery over that field, carrying the query-levelboostmultiplied by the field boost ("title^3"→ per-field boost 3). - For
type: "phrase"andtype: "phrase_prefix"each field instead becomes aphrasequery withslop: 0. The prefix part is not implemented:phrase_prefixcurrently behaves as an exact phrase and does not expand its last term as a prefix. - Two or more fields are wrapped in a
boolwhoseshouldclauses are the per-field queries, with at least one field required; a single field collapses to that field’s query — a plainmatch.
Scores: should clauses add their per-document scores (the bool
default). The type additionally picks the combination used when one
field name resolves to several indexed sub-fields — best_fields
keeps the maximum, most_fields and cross_fields sum. cross_fields
does not blend term statistics across fields; each
field scores independently and the results merge.