Bird
0
0

Identify the error in this Elasticsearch query:

medium📝 Debug Q14 of 15
Elasticsearch - Basics and Architecture

Identify the error in this Elasticsearch query:

{
  "query": {
    "match": {
      "content": apple
    }
  }
}
AThe match query should be outside the query object.
BThe field name content should be in quotes.
CThe search text apple should be in quotes.
DThe query object is missing a closing brace.
Step-by-Step Solution
Solution:
  1. Step 1: Check JSON syntax for values

    In JSON, string values must be enclosed in double quotes. Here, apple is unquoted.
  2. Step 2: Verify other parts of the query

    The field name and braces are correctly quoted and closed. The match query is correctly inside query.
  3. Final Answer:

    The search text apple should be in quotes. -> Option C
  4. Quick Check:

    Strings need quotes in JSON [OK]
Quick Trick: Always quote string values in JSON queries [OK]
Common Mistakes:
MISTAKES
  • Leaving string values unquoted
  • Misplacing match outside query
  • Forgetting closing braces

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes