Bird
0
0

You have this mapping:

medium📝 Debug Q14 of 15
Elasticsearch - Mappings and Data Types
You have this mapping:
{
  "properties": {
    "username": { "type": "keyword" },
    "bio": { "type": "text" }
  }
}
A developer tries to filter users with username containing "john" using this query:
{ "match": { "username": "john" } }
Why does this query not work as expected?
ABecause match query only works on numeric fields
BBecause username field should be of type text for exact matches
CBecause match query does not work on keyword fields for partial matches
DBecause bio field should be used instead of username
Step-by-Step Solution
Solution:
  1. Step 1: Understand keyword field behavior

    Keyword fields are not analyzed and do not support partial matching with match query.
  2. Step 2: Understand match query limitations

    Match query analyzes input and is meant for text fields, not keyword fields which require term or wildcard queries for partial matches.
  3. Final Answer:

    Because match query does not work on keyword fields for partial matches -> Option C
  4. Quick Check:

    Match query + keyword field = no partial match [OK]
Quick Trick: Match query needs text fields, not keyword [OK]
Common Mistakes:
MISTAKES
  • Thinking keyword fields support partial match with match query
  • Confusing field types for filtering
  • Using match query on numeric or date fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes