Bird
0
0

What will be the result of this query?

medium📝 Predict Output Q5 of 15
Elasticsearch - Basic Search Queries
What will be the result of this query?
{"query": {"exists": {"field": "address.city"}}}
Assuming some documents have 'address' but no 'city' field inside it.
AOnly documents with 'address.city' field present will be returned
BAll documents with 'address' field will be returned
CDocuments missing 'address.city' but having 'address' will be returned
DNo documents will be returned
Step-by-Step Solution
Solution:
  1. Step 1: Understand nested field checking in exists query

    The query checks specifically for the nested field 'address.city', not just 'address'.
  2. Step 2: Analyze document matching

    Only documents where 'address.city' exists will match; documents with 'address' but missing 'city' won't match.
  3. Final Answer:

    Only documents with 'address.city' field present will be returned -> Option A
  4. Quick Check:

    exists query matches exact nested field [OK]
Quick Trick: Exists query checks full field path, including nested fields [OK]
Common Mistakes:
MISTAKES
  • Assuming parent field presence is enough
  • Ignoring nested field specificity

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes