What if you could search many places at once with just one simple question?
Why Multi-match query in Elasticsearch? - Purpose & Use Cases
Imagine you have a huge library of books and you want to find all books that mention a certain word either in the title, the author name, or the summary. You try searching each field one by one manually.
Searching each field separately means you have to write many queries and combine results yourself. This is slow, complicated, and easy to miss matches if you forget a field. It's like looking for a needle in many haystacks one by one.
The multi-match query lets you search multiple fields at once with a single query. It automatically checks all the fields you want and finds the best matches, saving time and effort.
GET /books/_search
{
"query": {
"bool": {
"should": [
{ "match": { "title": "magic" } },
{ "match": { "author": "magic" } },
{ "match": { "summary": "magic" } }
]
}
}
}GET /books/_search
{
"query": {
"multi_match": {
"query": "magic",
"fields": ["title", "author", "summary"]
}
}
}It makes searching across many fields simple and powerful, helping you find relevant results faster and with less code.
When shopping online, you want to find products by name, description, or brand all at once. Multi-match query helps the search engine do exactly that behind the scenes.
Manual searching across fields is slow and error-prone.
Multi-match query searches many fields in one go.
This saves time and finds better results easily.