Bird
0
0

What will be the output of this Elasticsearch query?

medium📝 Predict Output Q5 of 15
Elasticsearch - Basic Search Queries
What will be the output of this Elasticsearch query?
{ "query": { "term": { "status": "active" } } }

Assuming documents have a "status" field with values like "active", "inactive".
ADocuments with status field missing
BDocuments where the status field contains the word "active" anywhere
CDocuments sorted by status field
DDocuments where the status field exactly matches "active"
Step-by-Step Solution
Solution:
  1. Step 1: Understand the term query behavior

    The term query looks for exact matches of the value in the specified field.
  2. Step 2: Apply to the "status" field with value "active"

    It returns documents where "status" exactly equals "active", not partial matches or sorting.
  3. Final Answer:

    Documents where the status field exactly matches "active" -> Option D
  4. Quick Check:

    Term query = Exact match [OK]
Quick Trick: Term query matches exact field values [OK]
Common Mistakes:
MISTAKES
  • Confusing term with match query
  • Expecting partial matches
  • Assuming sorting happens

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes