Bird
0
0

Which of the following is the correct syntax for an exists query in Elasticsearch?

easy📝 Syntax Q12 of 15
Elasticsearch - Basic Search Queries
Which of the following is the correct syntax for an exists query in Elasticsearch?
A{"query": {"exists": {"field_name": "user"}}}
B{"query": {"exists": "user"}}
C{"query": {"exists": {"value": "user"}}}
D{"query": {"exists": {"field": "user"}}}
Step-by-Step Solution
Solution:
  1. Step 1: Recall the correct JSON structure for exists query

    The exists query requires a "field" key inside its object specifying the field name.
  2. Step 2: Match options to correct syntax

    {"query": {"exists": {"field": "user"}}} matches the correct syntax: {"exists": {"field": "user"}}. Others use wrong keys or structure.
  3. Final Answer:

    {"query": {"exists": {"field": "user"}}} -> Option D
  4. Quick Check:

    Exists query syntax uses "field" key [OK]
Quick Trick: Exists query needs "field" key inside its object [OK]
Common Mistakes:
MISTAKES
  • Using "value" or "field_name" instead of "field"
  • Omitting the object braces around field
  • Passing field as a string directly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes