What are index templates and component templates in Elasticsearch?
Answer
Index templates automatically apply settings, mappings, and aliases to new indices when they are created, if the index name matches the template's index pattern. This is essential for time-series data where a new index is created every day (e.g., logs-2026-06-01). Component templates (introduced in ES 7.8) are reusable building blocks of settings and mappings that can be composed into index templates — promoting DRY (Don't Repeat Yourself) configuration. For example, you might have a component template with common ILM settings and another with standard log field mappings, combining them into multiple index templates for different log sources.
Previous
What is the difference between text and keyword field types?
Next
What is the Reindex API and when would you use it?
More Elasticsearch Questions
View all →- Intermediate What is the difference between query context and filter context in Elasticsearch?
- Intermediate What is a bool query in Elasticsearch?
- Intermediate What are aggregations in Elasticsearch?
- Intermediate What is the difference between text and keyword field types?
- Intermediate What is the Reindex API and when would you use it?