0
0
Elasticsearchquery~20 mins

Index templates in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Index Template Mastery
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 index template creation?
Given this Elasticsearch index template creation command, what will be the number of shards for any new index matching the pattern?
Elasticsearch
{
  "index_patterns": ["logs-*"],
  "template": {
    "settings": {
      "number_of_shards": 3,
      "number_of_replicas": 1
    }
  }
}
ANew indices matching 'logs-*' will have 1 shard and 3 replicas.
BNew indices matching 'logs-*' will have 3 shards and 1 replica.
CNew indices matching 'logs-*' will have default shards and replicas because the template is invalid.
DNew indices matching 'logs-*' will have 3 shards but 0 replicas.
Attempts:
2 left
💡 Hint
Look at the settings inside the template for shards and replicas.
🧠 Conceptual
intermediate
1:30remaining
What is the main purpose of an index template in Elasticsearch?
Choose the best description of what an index template does.
AIt monitors cluster health and sends alerts.
BIt deletes old indices based on age.
CIt automatically applies settings and mappings to new indices matching a pattern.
DIt backs up existing indices to a remote location.
Attempts:
2 left
💡 Hint
Think about how you can prepare new indices before they are created.
📝 Syntax
advanced
2:30remaining
Which option correctly defines an index template with a priority of 10?
Select the valid JSON snippet that sets an index template with priority 10.
A{ "index_patterns": ["app-*"], "priority": 10, "template": { "settings": { "number_of_shards": 2 } } }
B{ "index_patterns": ["app-*"], "template": { "priority": 10, "settings": { "number_of_shards": 2 } } }
C{ "priority": 10, "index_patterns": ["app-*"], "settings": { "number_of_shards": 2 } }
D{ "index_patterns": ["app-*"], "template": { "settings": { "number_of_shards": 2 } }, "priority": "ten" }
Attempts:
2 left
💡 Hint
Priority is a top-level field, not inside template.
optimization
advanced
3:00remaining
How can you optimize index templates to reduce duplication when multiple templates share settings?
Which approach best reduces duplication across multiple index templates?
ACopy and paste the same settings into each index template.
BAvoid using templates and set settings manually per index.
CCreate one large index template that matches all patterns.
DUse component templates and compose them in index templates.
Attempts:
2 left
💡 Hint
Think about reusable building blocks in Elasticsearch templates.
🔧 Debug
expert
3:00remaining
Why does this index template fail to apply settings to new indices?
Given this template JSON, why won't new indices matching 'data-*' get the custom analyzer? { "index_patterns": ["data-*"], "settings": { "analysis": { "analyzer": { "custom_lowercase": { "type": "custom", "tokenizer": "standard", "filter": ["lowercase"] } } } } }
AThe 'settings' block must be inside a 'template' object, not at the top level.
BThe analyzer name 'custom_lowercase' is invalid and must be 'lowercase_custom'.
CIndex patterns must be a string, not an array.
DThe 'filter' field should be 'filters' in the analyzer definition.
Attempts:
2 left
💡 Hint
Check the required structure of an index template JSON.