Bird
Raised Fist0

Identify the error in this percolate query:

medium📝 Debug Q14 of Q15
Elasticsearch - Advanced Patterns

Identify the error in this percolate query:

{
  "query": {
    "percolate": {
      "field": "query"
      "document": {
        "content": "Test document"
      }
    }
  }
}
A"field" should be "query_field"
BMissing comma between "field" and "document" fields
C"document" must include an "id" field
DPercolate query cannot use 'content' field in document
Step-by-Step Solution
Solution:
  1. Step 1: Check JSON syntax in query

    Between "field" and "document" keys, a comma is missing, causing invalid JSON.
  2. Step 2: Validate other parts

    "field" name is correct, "document" can omit "id", and "content" is valid as document content.
  3. Final Answer:

    Missing comma between "field" and "document" fields -> Option B
  4. Quick Check:

    JSON syntax error = missing comma [OK]
Quick Trick: Check commas between JSON fields carefully [OK]
Common Mistakes:
MISTAKES
  • Forgetting commas between JSON keys
  • Assuming document must have an ID
  • Changing field names unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes