Bird
0
0

Identify the error in this bool query:

medium📝 Debug Q14 of 15
Elasticsearch - Basic Search Queries
Identify the error in this bool query:
{
  "bool": {
    "must": { "match": { "title": "Elasticsearch" } },
    "filter": { "term": { "status": "published" } },
    "must_not": [ { "term": { "archived": true } } ]
  }
}
A"must" should be an array, not an object
B"filter" cannot be used with "must_not"
C"must_not" should be an object, not an array
DThe query is correct as is
Step-by-Step Solution
Solution:
  1. Step 1: Check must clause format

    The must clause expects an array of query objects, but here it is given as a single object.
  2. Step 2: Validate other clauses

    The filter and must_not clauses are correctly formatted as an object and an array respectively.
  3. Final Answer:

    "must" should be an array, not an object -> Option A
  4. Quick Check:

    Must clause = array required [OK]
Quick Trick: Must clause must always be an array [OK]
Common Mistakes:
MISTAKES
  • Using object instead of array for must
  • Thinking filter and must_not conflict
  • Using array for must_not incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes