Bird
0
0

What will be the result of this Elasticsearch query?

medium📝 Predict Output Q4 of 15
Elasticsearch - Basic Search Queries
What will be the result of this Elasticsearch query?
{ "query": { "match": { "description": "fast car" } } }

Assuming the index contains documents with descriptions like "fast red car", "slow car", and "fast bike".
AOnly documents with exact phrase 'fast car' will be matched
BDocuments containing both 'fast' and 'car' will be matched
CNo documents will be matched
DDocuments containing either 'fast' or 'car' will be matched
Step-by-Step Solution
Solution:
  1. Step 1: Understand default behavior of match query

    The match query by default uses an OR operator, so it matches documents containing any of the words.
  2. Step 2: Apply to given documents

    "fast red car" contains both hence matches, "slow car" contains 'car', "fast bike" contains 'fast'.
  3. Final Answer:

    Documents containing either 'fast' or 'car' will be matched -> Option D
  4. Quick Check:

    Default operator in match query = OR [OK]
Quick Trick: Match query defaults to OR operator between words [OK]
Common Mistakes:
MISTAKES
  • Assuming match query searches exact phrases by default
  • Thinking match query uses AND operator by default
  • Expecting no matches if words are separated

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes