Bird
0
0

What is wrong with this Elasticsearch mapping for a numeric field?

medium📝 Debug Q14 of 15
Elasticsearch - Mappings and Data Types

What is wrong with this Elasticsearch mapping for a numeric field?

{
  "mappings": {
    "properties": {
      "score": {
        "type": "integer",
        "index": "not_analyzed"
      }
    }
  }
}
A'type' should be 'float' instead of 'integer'
B'score' field name is not allowed
C'index' parameter is invalid for numeric fields
DMapping syntax is missing a closing brace
Step-by-Step Solution
Solution:
  1. Step 1: Review the 'index' parameter usage

    Numeric fields do not support 'index' with 'not_analyzed'; this is for text fields.
  2. Step 2: Confirm correct mapping for numeric fields

    Numeric fields are indexed by default and do not use 'not_analyzed'.
  3. Final Answer:

    'index' parameter is invalid for numeric fields -> Option C
  4. Quick Check:

    Numeric fields don't use 'index': 'not_analyzed' [OK]
Quick Trick: Don't use 'index':'not_analyzed' on numeric fields [OK]
Common Mistakes:
MISTAKES
  • Using text field options on numeric fields
  • Changing type unnecessarily
  • Ignoring Elasticsearch mapping syntax rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes