Bird
0
0

Given this mapping for a field price as float:

medium📝 Predict Output Q13 of 15
Elasticsearch - Mappings and Data Types
Given this mapping for a field price as float:
{
  "properties": {
    "price": { "type": "float" }
  }
}
What will happen if you index a document with "price": "cheap"?
AElasticsearch will store the string 'cheap' as is without error
BElasticsearch will index the document but ignore the price field
CElasticsearch will convert 'cheap' to 0.0 automatically
DElasticsearch will reject the document with a mapping type conflict error
Step-by-Step Solution
Solution:
  1. Step 1: Understand type enforcement in mappings

    Elasticsearch enforces the data type defined in mappings. If a field is float, it expects a number.
  2. Step 2: Analyze the input value

    The value 'cheap' is a string, not a float, so Elasticsearch will raise a type conflict error when indexing.
  3. Final Answer:

    Elasticsearch will reject the document with a mapping type conflict error -> Option D
  4. Quick Check:

    Type mismatch causes error = Elasticsearch will reject the document with a mapping type conflict error [OK]
Quick Trick: Data must match mapping type or indexing fails [OK]
Common Mistakes:
MISTAKES
  • Assuming Elasticsearch auto-converts strings to numbers
  • Thinking Elasticsearch silently ignores wrong types
  • Believing string values are stored despite float mapping

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes