Open andreidan opened 2 years ago
Pinging @elastic/es-data-management (Team:Data Management)
It looks like ilm-history might be in good company. From a new 8.0 development cluster:
curl -s localhost:9200/_index_template | jq '.index_templates[] | .name'
".watch-history-16"
".monitoring-beats-mb"
".monitoring-kibana-mb"
"synthetics"
".ml-state"
"ilm-history"
".monitoring-es-mb"
".monitoring-logstash-mb"
".slm-history"
".ml-anomalies-"
"metrics"
".ml-notifications-000002"
".deprecation-indexing-template"
"logs"
".ml-stats"
Most of these are data streams. I think we should discuss how best to model upgrades to these templates. I am not sure if I agree with using a version number in the name of the template especially if it also requires a new data stream name. Some access patterns may have the full data stream name hard coded and we could break those access patterns (unless we introduced aliases which isn't quite 100% for data streams). Ideally the version number would be only an internal implementation detail.
I am not sure if I agree with using a version number in the name of the template especially if it also requires a new data stream name.
@jakelandis changing the data stream name wouldn't be required. When creating the newly named index template we'd need to use a priority higher than the one used by the index template we're retiring (and eventually, a bit of future thinking, deleting by the same infrastructure).
@jakelandis Having done some more testing I agree we need to discuss this.
You're right that we'd generate a new data stream name, but not because we'd use the version in the index template name, but because we use the version in the index pattern of the index template already https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/core/src/main/resources/ilm-history.json#L3
In other words, any update to the index template for which we'd normally bump the version will generate a new data stream name. And this is by design. And we should indeed revise this decision (I'm adding the team-discuss label for this).
We discussed this today and decided to introduce an internal version for the data stream name that will mostly remain stable and use the index template version for versioning the index template.
We'll also work on more guidance and governing around the IndexTemplateRegistry
infrastructure in a separate effort.
Elasticsearch Version
8.0
Installed Plugins
No response
Java Version
bundled
OS Version
Darwin
Problem Description
At the moment we use the
IndexTemplateRegistry
infrastructure to manage the index templates we want to ship with elasticsearch. The index templates however themselves can manage data streams. One example is theilm-history
index template managing theilm-history-5
data stream.If we'd attempt a change to the history index (say, we want to add a new field in the mapping) by bumping the template version, this will fail when running the new version because bumping the index template version changes the
index_patterns
the ilm-history template is matching, but the template is already used by the existingilm-history-5
data stream.The index template name should include the version in the name, so we create a new template when we make changes.
[NOTE] there might be other users of the
IndexTemplateRegistry
in this situation.This would yield an exception like this at startup
Steps to Reproduce
./gradlew clean :distribution:archives:darwin-tar:assemble
)Logs (if relevant)
No response