0
0
Elasticsearchquery~20 mins

Index mappings overview in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Index Mapping Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
What is the output of this mapping query?
Given this Elasticsearch index mapping, what is the type of the field user.age?
Elasticsearch
{
  "mappings": {
    "properties": {
      "user": {
        "properties": {
          "name": { "type": "text" },
          "age": { "type": "integer" }
        }
      }
    }
  }
}
A"keyword"
B"text"
C"integer"
D"date"
Attempts:
2 left
💡 Hint
Look inside the nested properties under user.
🧠 Conceptual
intermediate
2:00remaining
Which statement about Elasticsearch mappings is true?
Choose the correct statement about index mappings in Elasticsearch.
AMappings define how documents are indexed and stored in Elasticsearch.
BMappings are only used to store the document data without any structure.
CMappings automatically update field types when new data is indexed.
DMappings are unrelated to search performance.
Attempts:
2 left
💡 Hint
Think about what controls the structure and data types in Elasticsearch.
📝 Syntax
advanced
2:00remaining
Which mapping snippet is syntactically correct for a date field with a custom format?
Select the valid Elasticsearch mapping snippet that defines a created_at field as a date with format yyyy-MM-dd HH:mm:ss.
A"created_at": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss" }
B"created_at": { "type": "datetime", "format": "yyyy-MM-dd HH:mm:ss" }
C"created_at": { "type": "date", "format": "date_optional_time" }
D"created_at": { "type": "string", "format": "yyyy-MM-dd HH:mm:ss" }
Attempts:
2 left
💡 Hint
Check the valid type name for date fields in Elasticsearch.
optimization
advanced
2:00remaining
Which mapping choice improves search performance for exact matches on a username?
You want to optimize search for exact username matches. Which mapping is best?
A"username": { "type": "text", "index": false }
B"username": { "type": "keyword" }
C"username": { "type": "text", "analyzer": "standard" }
D"username": { "type": "text" }
Attempts:
2 left
💡 Hint
Exact matches work best on fields that are not analyzed.
🔧 Debug
expert
2:00remaining
What error occurs with this mapping snippet?
This mapping snippet is used to create an index. What error will Elasticsearch raise?
Elasticsearch
{
  "mappings": {
    "properties": {
      "price": { "type": "float" },
      "price": { "type": "integer" }
    }
  }
}
AIndexCreationException due to missing required fields
BNo error, Elasticsearch merges the fields automatically
CSyntaxError due to invalid JSON format
DMappingConflictException due to duplicate field names with different types
Attempts:
2 left
💡 Hint
Check if you can define the same field twice with different types.