-
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
Some template alias settings are not persisted on PUT template #63162
Conversation
Pinging @elastic/es-core-features (:Core/Features/Features) |
3207114
to
e07ebac
Compare
run elasticsearch-ci/packaging-sample-windows |
pinging @elastic/es-core-features I've got a small change here for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this @davidkyle, I left a comment about a change I think we should do in this PR, but otherwise this looks good.
.filter(alias.filter()) | ||
.indexRouting(alias.indexRouting()) | ||
.searchRouting(alias.searchRouting()) | ||
.writeIndex(alias.writeIndex()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually don't think we should persist this one. Putting a template in place with is_write_index: true
will be confusing because only a single index can be marked as the write index. I think we should instead throw an exception if alias.writeIndex()
is set to true
here (fail early rather than fail late)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes perfect sense. I added a validation against the alias having is_write_index: true
and updated the tests
4d3002c
to
f215de9
Compare
The build failures are all a result of the new validation that the template alias cannot be a write alias.
@dakrone I will defer to you on how to proceed with this change. Not persisting the
https://gradle-enterprise.elastic.co/s/kwfgkm34j7avy/tests/failed |
Okay, I looked into what it would take to fix the tests, I think that gets a little bit more out of scope for this PR. I think it's reasonable to persist all the settings for this PR, and then I can open a follow-up issue where we disallow the write index alias setting (fixing the tests in a separate PR). Do you want to revert/undo the change that adds the exception throwing and we can merge this? (I'll open up the follow-up issue and make sure our team discusses the repercussions) |
This reverts commit f215de9.
Thanks @dakrone I reverted the validate write alias change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for iterating on this!
If the templates contains an alias the fields is_write_index and is_hidden are now copied to the metadata object and persisted
Templates that use aliases do not persist all of the alias options. The fix is to copy over those settings to the alias metadata
The bug is easy to recreate
Then when the template is read back the
is_hidden
field has mysteriously disappeared.