Ignore missing component templates
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. Serverless interfaces and procedures might differ from classic Elastic Stack deployments. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless
Generally available
Stack
Generally available
When an index template references a component template that might not exist, the ignore_missing_component_templates configuration option can be used. With this option, every time a data stream is created based on the index template, the existence of the component template will be checked. If it exists, it will used to form the index’s composite settings. If it is missing, it will be ignored.
The following example demonstrates how this configuration option works.
In this example, an index template and one component template are created. The index template references two component templates, but only one exists.
Suppose the logs-foo_component1 component template is created before the index template:
PUT _component_template/logs-foo_component1{ "template": { "mappings": { "properties": { "host.name": { "type": "keyword" } } } } }
Next, an index template is created, referencing two component templates:
"composed_of": ["logs-foo_component1", "logs-foo_component2"]
Since only the logs-foo_component1 component template was created previously, the logs-foo_component2 component template is missing. The following entry is added to the configuration:
"ignore_missing_component_templates": ["logs-foo_component2"],
The logs-foo index template will successfully be created, but it will not validate that logs-foo_component2 exists:
PUT _index_template/logs-foo{ "index_patterns": ["logs-foo-*"], "data_stream": { }, "composed_of": ["logs-foo_component1", "logs-foo_component2"], "ignore_missing_component_templates": ["logs-foo_component2"], "priority": 500 }
A data stream can be created based on this template:
PUT _data_stream/logs-foo-bar
The mappings of the data stream will contain the host.name field.
The missing component template can be added later:
PUT _component_template/logs-foo_component2{ "template": { "mappings": { "properties": { "host.ip": { "type": "ip" } } } } }
This will not have an immediate effect on the data stream. The mapping host.ip will only show up in the data stream mappings when the data stream is rolled over automatically next time or a manual rollover is triggered:
POST logs-foo-bar/_rollover