Complete the code to define a template that applies to all indices starting with 'logs-'.
{
"index_patterns": ["[1]"],
"settings": {
"number_of_shards": 1
}
}The pattern 'logs-*' matches all indices starting with 'logs-'. This is how templates target indices by name pattern.
Complete the code to set the number of replicas to 2 in the template settings.
{
"settings": {
"number_of_replicas": [1]
}
}Setting 'number_of_replicas' to 2 means each shard has two copies for fault tolerance.
Fix the error in the template mapping by completing the field type for 'timestamp'.
"mappings": { "properties": { "timestamp": { "type": "[1]" } } }
The 'timestamp' field should be of type 'date' to store date and time values correctly.
Fill both blanks to create a template that applies to indices starting with 'app-' and sets refresh interval to 30s.
{
"index_patterns": ["[1]"],
"settings": {
"refresh_interval": "[2]"
}
}The pattern 'app-*' matches indices starting with 'app-'. The refresh interval '30s' sets how often the index refreshes.
Fill all three blanks to define a template with pattern 'metrics-*', 3 shards, and mapping type 'keyword' for 'host'.
{
"index_patterns": ["[1]"],
"settings": {
"number_of_shards": [2]
},
"mappings": {
"properties": {
"host": { "type": "[3]" }
}
}
}The pattern 'metrics-*' matches indices starting with 'metrics-'. Setting 3 shards splits data into three parts. The 'host' field uses 'keyword' type for exact matching.