Challenge - 5 Problems
Numeric Field Types Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this mapping for a numeric field?
Given this Elasticsearch mapping snippet, what is the type of the field
age and what is its default behavior?Elasticsearch
{
"mappings": {
"properties": {
"age": {
"type": "integer"
}
}
}
}Attempts:
2 left
💡 Hint
Think about the standard integer type in Elasticsearch and what it supports.
✗ Incorrect
In Elasticsearch, the
integer type is a 32-bit signed integer. It supports numeric operations like range queries. It does not support decimals or unsigned values.❓ Predict Output
intermediate2:00remaining
What happens when you index a decimal number into a field of type
long?Consider this mapping and document indexing:
Mapping:
{
"mappings": {
"properties": {
"price": {
"type": "long"
}
}
}
}
Document:
{
"price": 19.99
}
What will Elasticsearch do?
Attempts:
2 left
💡 Hint
Think about how Elasticsearch handles decimal values for integer types.
✗ Incorrect
Elasticsearch expects integer types like
long to receive whole numbers. Indexing a decimal into a long field causes a mapping exception error.🔧 Debug
advanced2:00remaining
Why does this mapping cause an error?
This mapping snippet causes an error when applied. Identify the cause:
{
"mappings": {
"properties": {
"score": {
"type": "unsigned_long"
}
}
}
}
Attempts:
2 left
💡 Hint
Check the official Elasticsearch numeric types supported.
✗ Incorrect
Elasticsearch does not have an
unsigned_long type. The valid integer types are byte, short, integer, and long. Using an unsupported type causes an error.📝 Syntax
advanced2:00remaining
Which mapping snippet correctly defines a
scaled_float field with a scaling factor of 100?Choose the correct Elasticsearch mapping for a
scaled_float field named rating with a scaling factor of 100.Attempts:
2 left
💡 Hint
Check the exact property name for scaling factor in the official docs.
✗ Incorrect
The correct property name is
scaling_factor. Option C uses the correct type and property name. Other options have wrong property names or types.🚀 Application
expert2:00remaining
How many numeric fields are created by this mapping?
Given this Elasticsearch mapping, how many numeric fields are defined?
{
"mappings": {
"properties": {
"id": { "type": "keyword" },
"count": { "type": "integer" },
"price": { "type": "scaled_float", "scaling_factor": 100 },
"rating": { "type": "float" },
"timestamp": { "type": "date" }
}
}
}
Attempts:
2 left
💡 Hint
Count only fields with numeric types like integer, float, scaled_float.
✗ Incorrect
The numeric fields are
count (integer), price (scaled_float), and rating (float). The id is keyword and timestamp is date, so they are not numeric.