Bird
0
0

Which of the following is the correct syntax for a prefix query in Elasticsearch?

easy📝 Syntax Q12 of 15
Elasticsearch - Basic Search Queries
Which of the following is the correct syntax for a prefix query in Elasticsearch?
A{ "prefix": { "field_name": "pre" } }
B{ "wildcard": { "field_name": "pre*" } }
C{ "match": { "field_name": "pre*" } }
D{ "term": { "field_name": "pre*" } }
Step-by-Step Solution
Solution:
  1. Step 1: Identify prefix query syntax

    Prefix queries use the prefix keyword with the field and the prefix string.
  2. Step 2: Check other options

    Wildcard queries use wildcard, match and term queries do not support prefix syntax with asterisk.
  3. Final Answer:

    { "prefix": { "field_name": "pre" } } -> Option A
  4. Quick Check:

    prefix query uses "prefix" keyword [OK]
Quick Trick: Prefix queries use "prefix" keyword, not wildcard or match [OK]
Common Mistakes:
MISTAKES
  • Using wildcard syntax for prefix query
  • Using match query with asterisk
  • Confusing term query with prefix query

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes