-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Filter enrich policy index deletes to just the policy's associated indices #82568
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
Filter enrich policy index deletes to just the policy's associated indices #82568
Conversation
If you delete a policy whose name is a prefix of another policy, it shouldn't delete the indices that are associated with that policy.
Either generating an index name from a policy name, or asking whether a given index name would have been generated from a given policy name.
They need to actually match the naming pattern relationship between a policy and a index.
Pinging @elastic/es-data-management (Team:Data Management) |
I did a little bit of spelunking back to when enrich was first added to master via #48039.
The important thing is that it's always been the case that the pattern is |
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, good catch!
@@ -82,12 +83,13 @@ protected void masterOperation( | |||
ClusterState state, | |||
ActionListener<AcknowledgedResponse> listener | |||
) throws Exception { | |||
EnrichPolicy policy = EnrichStore.getPolicy(request.getName(), state); // ensure the policy exists first | |||
String policyName = request.getName(); | |||
EnrichPolicy policy = EnrichStore.getPolicy(policyName, state); // ensure the policy exists first |
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.
maybe make these variables explicitly immutable?
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.
✅, d1658cf
@hendry-lim hasn't it? I'm seeing bae4e11 for 8.0 and 6bab477 for 7.17. |
If you have two enrich policies, and the name of the one plus a dash is a prefix for the name of the other (e.g. "policy-test" and "policy-test-more"), then if you delete the prefix policy the indices associated with the other policy will get deleted, too.