-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Treat aliases as unavailable indices in delete index and update aliases api #25524
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
Treat aliases as unavailable indices in delete index and update aliases api #25524
Conversation
dakrone
left a comment
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.
Left a few comments, but this LGTM. Cannot stress enough how much this needs to be rewritten and cleaned up though (in a subsequent PR), it's very difficult to reason about now.
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.
This comment no longer holds, since this is inside of an if statement checking that a wildcard has been seen
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.
good point, will remove
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 think when this is rewritten, I would prefer to have an .isConcreteIndex() method on AliasOrIndex to avoid the double negatives in comparisons, I had to stare at this for a while to validate it is working correctly.
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.
good point too
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.
This should either be assert false or be removed entirely, right now it's not doing anything?
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.
good catch, it's a leftover, I noticed that assertEmpty was always true so I just removed the argument. I think we can simply remove the assertion at this point.
c33ba00 to
4407c7b
Compare
…es api When resolving wildcards, aliases should be treated as unavailable indices when the `ignoreAliases` option is set to `true` (currently enabled with delete index api and update aliases api). This way the `allow_no_indices` and `ignore_unavailable` options can be honoured, otherwise WildcardExpressionResolver ends up treating aliases differently and there is no way to control when an error is thrown. The default behaviour for the delete index api, which has `ignore_unavailable` set to `false` and `allow_no_indices` set to `true` by default, is to throw an error when executed against an alias, same as when it's executed against an index that does not exist.
4407c7b to
594f4b9
Compare
This is a follow-up of #23997 and #25268.
When resolving wildcards, aliases should be treated as unavailable indices when the
ignoreAliasesoption is set totrue(currently enabled with delete index api and update aliases api). This way theallow_no_indicesandignore_unavailableoptions can be honoured, otherwiseWildcardExpressionResolverends up treating aliases differently and there is no way to control when an error is thrown.The default behaviour for the delete index api, which has
ignore_unavailableset tofalseandallow_no_indicesset totrueby default, is to throw an error when executed against an alias, same as when it's executed against an index that does not exist.