Bird
0
0

You wrote this prefix query but it returns no results:

medium📝 Debug Q14 of 15
Elasticsearch - Basic Search Queries
You wrote this prefix query but it returns no results:
{ "query": { "prefix": { "title": "prog*" } } }

What is the error?
AField name "title" is invalid
BPrefix query should not include the asterisk (*)
CPrefix queries require wildcard keyword
DPrefix query must use match instead of prefix
Step-by-Step Solution
Solution:
  1. Step 1: Understand prefix query syntax

    Prefix queries expect a string prefix without wildcards like '*'. The asterisk is not needed and causes no matches.
  2. Step 2: Check other options

    Field name is assumed valid, wildcard keyword is different query type, and match query is unrelated to prefix syntax.
  3. Final Answer:

    Prefix query should not include the asterisk (*) -> Option B
  4. Quick Check:

    Prefix query uses plain prefix string, no * [OK]
Quick Trick: Remove * from prefix query string to fix [OK]
Common Mistakes:
MISTAKES
  • Including * in prefix query string
  • Confusing prefix with wildcard query
  • Using match query instead of prefix

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes