-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply changes to index/component templates to affected data streams #96521
Comments
Pinging @elastic/es-data-management (Team:Data Management) |
@felixbarny we are currently having some issues when updating mappings in Fleet where we do not trigger a rollover and where we should, I think having something like |
Hey Nicolas, I'm glad you like the idea. We haven't discussed this further. @dakrone what do you think about this approach? |
An idea that was brought up by @dakrone is that we could prototype this by not exposing the This approach lets us experiment and iterate quickly, without having to worry about backwards compatibility for exposing this to external clients. Once we're happy with the result, we can expose it so that Fleet and other clients can rely on it. |
There's a potential issue with this approach that may lead to multiple rollovers. Consider a situation where the user has the following index and component templates:
Now we update these templates that all include changes that require a rollover:
In total, we roll over Maybe there should be a dedicate API for the "apply" step so that you can first update all templates and then rollover where necessary. Something like this: Update all templates first, without triggering a rollover
Then, apply changes and trigger a rollover if necessary
alternatively:
or
or also
|
@felixbarny I think the current way that registries work is not suitable for this kind of synchronization, as there is no point in time that indicates that "the registry update is complete". ATM, there can only be an indication that assets upgrades were triggered. Even with a change like proposed in #99647 (comment), I don't know if this will be changed as it means changing the way of how component installation synchronization now works based on continuous comparison between desired and current cluster state. However, if we apply this proposal only to index templates APIs, I think this multi-rollover problem can be resolved, because a data stream is only "affected" by a single index template. Part of this would be to make sure that an index template only gets upgraded after all its dependencies have been upgraded, like we did in #97546 (and need to complete with #99647). This is valid only if limiting the solution for index templates is acceptable. Related to that, I think the the idea described above implies that if we indeed do such validation in the "client side" (meaning - the side that submits the API requests), then #99647 may be a blocker |
Today, Fleet is responsible for both updating the index templates and making sure these updates are applied to the corresponding data streams.
The way how Fleet computes the diff between the current state of a data stream and how it determines whether to update or roll over data streams is complex, flawed (see elastic/kibana#158653), brittle (for example elastic/kibana#158654, elastic/kibana#157869), and shouldn't be the responsibility of Fleet as it's a more general data management problem.
Borrowing ideas from Infrastructure as Code, there should be a way to declare the desired end state of new and existing data streams that match a given pattern and ES is responsible to determine what it needs to do to reach that state.
This docs page explains the different steps user need to do to modify a data stream: https://www.elastic.co/guide/en/elasticsearch/reference/current/modify-data-streams.html
The goal is that there's a single way to update a data stream so that users (including Fleet) don't need to determine whether or not they need to trigger a rollover and don't need to manually create a diff to update each data stream to be consistent with its index template.
A possible solution for this could be to add a new parameter to the put index template and component template APIs (something like
apply: true
). This will determine all matching data streams, and apply the changes needed so that the data stream's mappings and settings are consistent with the index template. It will also automatically determine whether the change requires a roll over of the data stream (for example, if a static index setting is changed or when an existing field mapping is changed) or whether updating the data stream is sufficient (for example, when only dynamic index settings are changed or when only adding fields to the mappings), to avoid creating unnecessary backing indices.The text was updated successfully, but these errors were encountered: