The stack.templates.enabled
setting in Elasticsearch controls whether built-in index templates for the Elastic stack are automatically created and managed.
- Default value:
true
- Possible values:
true
orfalse
- Recommendation: Keep the default value unless you have specific reasons to disable it
This setting determines if Elasticsearch should automatically create and manage built-in index templates for various Elastic stack components, such as Logstash, Beats, and other Elastic products. These templates help ensure that indices created by these components have appropriate mappings and settings.
This setting was introduced in Elasticsearch 7.8.0.
Example
To disable the automatic creation of stack templates:
PUT /_cluster/settings
{
"persistent": {
"stack.templates.enabled": false
}
}
Reasons for changing this setting might include:
- Custom management of index templates
- Preventing potential conflicts with user-defined templates
- Troubleshooting template-related issues
Effects of disabling:
- Built-in templates won't be created or updated automatically
- You'll need to manage templates manually for Elastic stack components
Common Issues
- Unexpected index mappings when the setting is disabled
- Conflicts between custom templates and built-in templates
Do's and Don'ts
Do's:
- Keep this setting enabled unless you have a specific reason to disable it
- Monitor template changes if you disable this setting
- Understand the implications on your Elastic stack components before disabling
Don'ts:
- Don't disable this setting without a clear understanding of how it affects your Elastic stack
- Don't forget to create necessary templates manually if you disable this setting
Frequently Asked Questions
Q: What happens if I disable stack.templates.enabled?
A: When disabled, Elasticsearch won't automatically create or update built-in index templates for Elastic stack components. You'll need to manage these templates manually.
Q: Can I re-enable stack.templates.enabled after disabling it?
A: Yes, you can re-enable it at any time using the cluster settings API. Elasticsearch will then create and manage the built-in templates again.
Q: Will disabling stack.templates.enabled affect my existing indices?
A: No, it won't affect existing indices. It only impacts the creation and management of built-in templates for future indices.
Q: How can I view the current stack templates if they're enabled?
A: You can use the GET _index_template API to view all index templates, including stack templates.
Q: Should I disable stack.templates.enabled if I'm using custom templates?
A: Not necessarily. You can use custom templates alongside built-in templates. However, if you want full control over all templates, you might consider disabling it.