Best Division

Spread Your Knowledge

  • All topics
  • About us
  • Contact us
  • Privacy policy
  • Terms of service
  • Copyright
  • Facebook
  • Twitter
  • Instagram
  • Youtube
  • LinkedIn
  • Pinterest
  • Github
  • Tumblr

© 2026 Best Division

How Do You Use the Match Query in Elasticsearch?

Elasticsearch
Jayant Kumar
Jayant Kumar@jayantkumar314
PublishedNov 29, 2026
5 min read

The match query is the standard full-text query in Elasticsearch. You give it a field and some text, Elasticsearch analyzes the text with the field's analyzer, and it returns documents that contain any of the resulting terms, ranked by relevance. This guide shows how to use the elasticsearch match query with options such as operator, minimum_should_match and fuzziness.

The examples run on Elasticsearch 8.x and 9.x.

Table of Contents

  • A basic match query
  • How the analyzer affects matching
  • The operator option
  • Using minimum_should_match
  • Fuzzy matching for typos
  • Related queries you will meet next
  • Reading the results
  • Frequently Asked Questions
    • Is match case sensitive?
    • What is the difference between match and term?
    • Why does match return documents with only one of my words?
    • How do I match several fields?
  • Summary
  • Related Articles

A basic match query

Assume an index articles with a title field of type text.

json
json

The query text is analyzed into the terms elasticsearch and search. By default a document matches when it contains at least one of them, so documents 1 and 2 are returned. Document 2 has both terms and gets the higher score, because BM25 rewards documents that match more terms and rarer terms.

How the analyzer affects matching

The match query runs the query string through the same analyzer as the field (unless you set analyzer in the query). That is why Elasticsearch, ELASTICSEARCH and elasticsearch all match: the standard analyzer lowercases both indexed text and queries.

This also means match is the wrong tool for exact values. On a keyword field, match does not analyze and behaves like an exact term lookup. On a text field, use match for words and use a term query on a keyword subfield for exact strings.

The operator option

By default the terms are combined with or. Set operator to and to require every term.

json

Now only document 2 matches. Use and when precision matters, and keep or when you prefer recall and rely on scoring to put the best hits first.

Using minimum_should_match

For a middle ground, require a number or percentage of the terms.

json

With four terms, 75 percent means at least three must be present. This tolerates one missing word, which suits long natural-language queries.

Fuzzy matching for typos

Add fuzziness to match terms within a small edit distance.

json

AUTO picks the allowed number of edits from the term length. Short terms get no or few edits, longer terms get up to two. Fuzzy queries cost more than plain ones, so use them when typo tolerance is worth it. You can also set prefix_length so the first characters must match exactly, which makes the query faster.

Related queries you will meet next

QueryUse it when
match_phraseWords must appear together in order
multi_matchYou search several fields at once
match_allYou want every document
match_bool_prefixYou search as the user types
termYou need an exact value without analysis

Pick match_phrase for names and quoted phrases, and multi_match when the same text should search title, body and tags with different boosts.

Reading the results

Each hit contains _score and _source. Add "explain": true to see why a score was assigned, and use the analyze API on the field if a document you expected is missing. The cause is usually the analyzer, for example the field is a keyword, or a stop word was removed.

Frequently Asked Questions

Is match case sensitive?

Not on analyzed text fields with the default analyzer, because tokens are lowercased. On keyword fields it is case sensitive.

What is the difference between match and term?

match analyzes the query text and is meant for text fields. term does not analyze the value and is meant for exact values on keyword, numeric and date fields.

Why does match return documents with only one of my words?

The default operator is or. Set operator to and or use minimum_should_match to require more terms.

How do I match several fields?

Use multi_match with a fields list, or a bool query with several match clauses.

Summary

The match query analyzes your text and finds documents with any of the terms by default. Control precision with operator and minimum_should_match, tolerate typos with fuzziness, and switch to match_phrase, multi_match or term when the requirement is different.

Related Articles

  • What Is the Elasticsearch Query DSL?
  • How do you search an exact phrase with match_phrase?
  • Learn Elasticsearch: Complete Study Roadmap, Beginner to Advanced
Share