Bird
Raised Fist0

What is missing or incorrect in this percolate query snippet?

medium📝 Debug Q6 of Q15
Elasticsearch - Advanced Patterns

What is missing or incorrect in this percolate query snippet?

{
  "query": {
    "percolate": {
      "field": "stored_query"
    }
  }
}
AThe <code>percolate</code> query cannot be used inside a <code>query</code> context
BThe <code>field</code> name should be <code>query</code> instead of <code>stored_query</code>
CThe query should be wrapped inside a <code>match</code> clause
DThe <code>document</code> parameter is missing, which specifies the document to match
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the percolate query structure

    The percolate query requires a document parameter to specify the document to match against stored queries.
  2. Step 2: Check the provided snippet

    The snippet only specifies the field but omits the document parameter.
  3. Step 3: Validate other options

    The field name can be arbitrary as long as it matches the mapping; wrapping in match is not required; percolate queries are valid inside query.
  4. Final Answer:

    The document parameter is missing, which specifies the document to match -> Option D
  5. Quick Check:

    Percolate queries must include a document to match [OK]
Quick Trick: Always include 'document' in percolate queries [OK]
Common Mistakes:
MISTAKES
  • Omitting the 'document' parameter
  • Assuming 'field' must be named 'query'
  • Wrapping percolate query incorrectly inside other clauses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes