Challenge - 5 Problems
Elasticsearch Template 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 template composition?
Given two index templates with different priorities, what will be the final settings applied to an index named
logs-2024?Elasticsearch
{
"index_templates": [
{
"name": "base_template",
"index_patterns": ["logs-*"],
"priority": 10,
"template": {
"settings": {
"number_of_shards": "3",
"refresh_interval": "30s"
}
}
},
{
"name": "override_template",
"index_patterns": ["logs-2024"],
"priority": 20,
"template": {
"settings": {
"refresh_interval": "10s",
"number_of_replicas": "2"
}
}
}
]
}Attempts:
2 left
💡 Hint
Remember that templates with higher priority override settings from lower priority templates when index patterns match.
✗ Incorrect
The
override_template has a higher priority (20) than base_template (10). Both match the index logs-2024. Settings from the higher priority template override conflicting keys, so refresh_interval becomes "10s" and number_of_replicas is added. The number_of_shards remains from the base template as it is not overridden.🧠 Conceptual
intermediate1:30remaining
Which template applies when multiple templates match with the same priority?
If two index templates have the same priority and both match an index, which template's settings will Elasticsearch apply?
Attempts:
2 left
💡 Hint
Think about how Elasticsearch resolves conflicts when priorities are equal.
✗ Incorrect
When multiple templates have the same priority and match an index, Elasticsearch applies them in order of their names sorted lexicographically ascending. The later templates override settings from earlier ones.
🔧 Debug
advanced2:00remaining
Why does this template composition not apply the expected settings?
You have two templates:
Template A (priority 5) matches
logs-* and sets refresh_interval to "30s".
Template B (priority 10) matches logs-2024-* and sets refresh_interval to "15s".
You create an index named logs-2023-01. The refresh_interval is "30s" instead of "15s". Why?Attempts:
2 left
💡 Hint
Check the index patterns carefully against the index name.
✗ Incorrect
Template B matches indices starting with
logs-2024-, but the index is logs-2023-01, so Template B does not apply. Only Template A applies, setting refresh_interval to "30s".📝 Syntax
advanced1:30remaining
Which template JSON is correctly structured for composition with priority?
Select the valid JSON structure for an index template with priority and settings composition.
Attempts:
2 left
💡 Hint
Check the data types and nesting of keys carefully.
✗ Incorrect
Option B correctly uses an array for
index_patterns, a numeric priority, and nests settings inside template. Option B uses string types incorrectly and index_patterns is not an array. Option B uses a string for priority which must be a number. Option B places settings outside template, which is invalid.🚀 Application
expert2:30remaining
How many settings keys will the final index have after applying these templates?
You have three templates:
1. Template X: priority 5, matches
logs-*, sets refresh_interval and number_of_shards.
2. Template Y: priority 10, matches logs-2024-*, sets number_of_replicas and overrides refresh_interval.
3. Template Z: priority 10, matches logs-2024-*, sets index.lifecycle.name.
You create an index named logs-2024-05. How many unique settings keys will the final index have?Attempts:
2 left
💡 Hint
Count all unique keys from all matching templates, considering overrides.
✗ Incorrect
Template X applies first (priority 5) and sets two keys:
refresh_interval and number_of_shards. Templates Y and Z both have priority 10 and match the index, so they apply next in lex order. Template Y sets number_of_replicas and overrides refresh_interval. Template Z adds index.lifecycle.name. The final unique keys are: number_of_shards, refresh_interval, number_of_replicas, and index.lifecycle.name — total 4.