liveBook · Manning

Multi_match query

As explained in Elasticsearch in Action, Second Edition

A multi_match query is an Elasticsearch full-text query that searches for analyzed terms across multiple specified fields.

A multi_match query searches analyzed terms across several specified fields, letting one search-bar request cover fields such as title, synopsis, and tags. Elasticsearch combines the individual field results into aggregated results and orders them by relevance score. section 10.8 section 2.3.4

Listing 10.14 Searching multiple fields using multi_match
GET books/_search
{
  "_source": false,          #1
  "query": {
    "multi_match": {         #2
      "query": "Java",       #3
      "fields": [            #4
        "title",
        "synopsis",
        "tags"
      ]
    }
  },
  "highlight": {             #5
    "fields": {
      "title": {},
      "tags": {}
    }
  }
}

Use this runnable books search to see the query text, field array, disabled source fields, and highlighting configuration together. section 10.8

Search movie fields

GET movies/_search { "query": { "multi_match": { "query": "Lord", "fields": ["synopsis", "title"] } } } The query searches for “Lord” in both movie synopsis and title fields. The same structure supports bookstore searches such as “Java” across title, synopsis, and tags. section 8.7.1 section 10.8

Adjust the request when field importance or result presentation matters:

  • Boost a field with caret notation, such as "title^2", so a title match receives more importance than a match in tags. section 10.8.4
  • Inspect relevance through each result’s _score; higher scores indicate stronger matches and determine result ordering. section 2.3.4
  • Add highlighting for selected fields when search results should show matching text, as in title and tags. section 10.8

How Elasticsearch in Action, Second Edition covers it

How deep it goes
Defines the query and demonstrates fields, aggregation, scoring, boosting, and highlighting without detailing analyzer or scoring internals.
Examples
Uses Java searches across book fields, a Lord search across movie fields, title boosting, and highlighted results.
What it assumes
Assumes basic Query DSL and match-query familiarity while introducing multi-field search through concrete JSON requests.
What you can do after
Apply it via Elasticsearch’s _search API to search several fields and tune ranking by boosting selected fields.
How it connects
Connects full-text search with match queries, relevance scoring, field boosting, Query DSL, and highlighting.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elasticsearch in Action, Second Edition. The section links point to the parts of the book it draws on.