Multi_match

Multi-match query

/ Multi_match, / Query

Multi-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 nested query: 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:

  1. Each entry in fields — after splitting off a ^boost suffix — becomes one match query over that field, carrying the query-level boost multiplied by the field boost ("title^3" → per-field boost 3).
  2. For type: "phrase" and type: "phrase_prefix" each field instead becomes a phrase query with slop: 0. The prefix part is not implemented: phrase_prefix currently behaves as an exact phrase and does not expand its last term as a prefix.
  3. Two or more fields are wrapped in a bool whose should clauses are the per-field queries, with at least one field required; a single field collapses to that field’s query — a plain match.

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.

...