log_templatelogs-*number_of_shards to 1timestamp field with type datelog_templatelogs-*number_of_shards to 1timestamp field with type datelog_template with an empty index_patterns list and empty template object.Use "index_patterns": ["logs-*"] to match indexes starting with logs-.
template object, add settings with number_of_shards set to 1.Put "number_of_shards": 1 inside settings.
template object, add a mappings object with a properties field. Define timestamp as a date type.Define timestamp inside properties with "type": "date".
index_patterns, template with settings and mappings as specified. This is the final complete index template.Review the entire JSON to confirm all parts are included and correctly formatted.
What is the main purpose of an index template in Elasticsearch?
Which of the following is the correct way to specify an index pattern in an Elasticsearch index template?
{
"index_patterns": ["logs-*"]
}index_patterns field expects an array of strings, so it must be inside square brackets.Given this index template:
{
"index_patterns": ["app-logs-*"],
"template": {
"settings": {"number_of_shards": 2},
"mappings": {"properties": {"user": {"type": "keyword"}}}
}
}What will be the number of shards and mapping type for the index app-logs-2024?
app-logs-2024 matches the pattern app-logs-* in the template.number_of_shards to 2 and maps the user field as keyword type.Identify the error in this index template snippet:
{
"index_patterns": "logs-*",
"template": {
"settings": {"number_of_replicas": 1}
}
}index_patterns field must be an array of strings, but here it is a single string.number_of_replicas is a valid setting, mappings is optional, and the pattern syntax is correct.You want to create an index template that applies to all indexes starting with sales- but excludes those ending with -archive. Which approach correctly achieves this?
sales-*-archive, create a separate template with higher priority that overrides or clears settings for those indexes.Pass the test and this pattern moves unknown