Add hook to provide settings and custom index metadata on mapping update#133232
Add hook to provide settings and custom index metadata on mapping update#133232felixbarny merged 16 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/es-data-management (Team:Data Management) |
|
As suggested by @dakrone, I’ll look into using custom index metadata instead of a private setting for my use case. If that approach works out well, I’ll probably enhance the settings provider interface so that it can provide custom index metadata when an index is created or updated. |
|
@dakrone thanks again for the suggestion. I've prototyped the approach in the context of #132566 and I like it lot better compared to the private index setting. It also avoids having to add infrastructure to allow providing private index settings when they're system-provided. I was also considering whether to expose the full I admit it's a bit weird that the class called |
dakrone
left a comment
There was a problem hiding this comment.
I don't love that we have both a return value and a passed in builder. I am on the fence about switching it to return void and instead passing in both the map builder and settings builder. I also wish we had a builder that was collection-compatible instead of using ImmutableOpenMap (though I understand why you used it).
But, I don't think those things need to hold this up, as they could be changed in the future transparently and without any breaking changes, so LGTM.
I don't like it either. I gave it a shot and make the refactoring. It's a lot better IMO. It's mostly mechanical changes that IntelliJ could assist me with. I also think it simplifies the control flow of existing implementations like
I've changed it to a |
|
I've reverted the changes to |
...ata-streams/src/main/java/org/elasticsearch/datastreams/DataStreamIndexSettingsProvider.java
Outdated
Show resolved
Hide resolved
...treams/src/test/java/org/elasticsearch/datastreams/DataStreamIndexSettingsProviderTests.java
Show resolved
Hide resolved
In elastic#133232, we've added the ability to provide index metadata with an IndexSettingProvider. It turned out that we don't need that functionality as we ended up using a private index setting in elastic#132566. This also adds the `IndexVersion` as another parameter. This is in preparation for [this](elastic#132566 (comment)) suggestion to conditionally set one or another setting, depending on the index version.
In #133232, we've added the ability to provide index metadata with an IndexSettingProvider. It turned out that we don't need that functionality as we ended up using a private index setting in #132566. This also adds the `IndexVersion` as another parameter. This is in preparation for [this](#132566 (comment)) suggestion to conditionally set one or another setting, depending on the index version. `IndexSettingProvider`s are now disallowed from providing the `index.version.created` setting. Otherwise, they can't rely on the `IndexVersion` they receive to be the one that will be actually used for the created index as another provider may change it.
Serverless part of elastic#133232
Serverless part of elastic#133232
Part of #132566