Delete index API to work only against concrete indices#25268
Merged
javanna merged 1 commit intoelastic:masterfrom Jun 16, 2017
Merged
Delete index API to work only against concrete indices#25268javanna merged 1 commit intoelastic:masterfrom
javanna merged 1 commit intoelastic:masterfrom
Conversation
With elastic#23997 we have introduced a new internal index option that allows to resolve index expressions only against concrete indices while ignoring aliases. Such index option was applied to IndicesAliasesRequest, so that the index part of alias actions would only be resolved against concrete indices. Same is done in this commit with delete index request. Deleting aliases has always been confusing as some users expect it to only remove the alias from the index (which has its own specific API). Even worse, in case of filtered aliases, deleting an alias may leave users with the expectation that only the documents that match the filter are deleted, which was never the case. To address all this confusion, delete index api works now only against concrete indices. WIldcard expressions will be only resolved against concrete index, as if aliases didn't exist. If one tries to delete against an alias, an IndexNotFoundException will be thrown regardless of whether the alias exists or not, as a concrete index with such a name doesn't exist. Closes elastic#2318
clintongormley
approved these changes
Jun 16, 2017
Contributor
clintongormley
left a comment
There was a problem hiding this comment.
Thanks @javanna LGTM but you need a Java review
Member
|
This is really good change @javanna! |
Contributor
|
hey @javanna. Can you also modify the reference docs for the delete api? (https://github.com/olcbean/elasticsearch/blob/delete_api_2318/docs/reference/indices/delete-index.asciidoc) |
Contributor
Author
|
good point @olcbean will do. I am sorry that you were working on this too. I didn't see any PR from you so I went ahead and created one, as we needed to get this change in. |
javanna
added a commit
to javanna/elasticsearch
that referenced
this pull request
Jul 11, 2017
Support for providing/matching aliases when using the delete index API will be removed in 6.0. This commit adds a deprecation warning for any delete index request that specifies aliases, or wildcard expressions that match aliases, on their index side. Relates to elastic#25268
javanna
added a commit
to javanna/elasticsearch
that referenced
this pull request
Jul 17, 2017
With elastic#23997 and elastic#25268 we have changed put alias, delete alias, update aliases and delete index to not accept aliases. Instead concrete indices should be provided as their index parameter. This commit improves the error message in case aliases are provided, from an IndexNotFoundException (404 status code) with "no such index" message, to an IllegalArgumentException (400 status code) with "The provided expression [alias] matches an alias, specify the corresponding concrete indices instead." message. Note that there is no specific error message for the case where wildcard expressions match one or more aliases. In fact, aliases are simply ignored when expanding wildcards for such APIs. An error is thrown only when the expression ends up matching no indices at all, and allow_no_indices is set to false. In that case the error is still the generic "404 - no such index".
javanna
added a commit
that referenced
this pull request
Jul 18, 2017
With #23997 and #25268 we have changed put alias, delete alias, update aliases and delete index to not accept aliases. Instead concrete indices should be provided as their index parameter. This commit improves the error message in case aliases are provided, from an IndexNotFoundException (404 status code) with "no such index" message, to an IllegalArgumentException (400 status code) with "The provided expression [alias] matches an alias, specify the corresponding concrete indices instead." message. Note that there is no specific error message for the case where wildcard expressions match one or more aliases. In fact, aliases are simply ignored when expanding wildcards for such APIs. An error is thrown only when the expression ends up matching no indices at all, and allow_no_indices is set to false. In that case the error is still the generic "404 - no such index".
ruflin
pushed a commit
to ruflin/Elastica
that referenced
this pull request
Aug 17, 2017
It has been introduced a BC into ES 6 which force to delete an index *only* with [**concrete Index name**](elastic/elasticsearch#25268). I've update a test, and created a new one to test the exception in case of index deletion by alias.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With #23997 we have introduced a new internal index option that allows to resolve index expressions only against concrete indices while ignoring aliases. Such index option was applied to IndicesAliasesRequest, so that the index part of alias actions would only be resolved against concrete indices.
Same is done in this commit with delete index request. Deleting aliases has always been confusing as some users expect it to only remove the alias from the index (which has its own specific API). Even worse, in case of filtered aliases, deleting an alias may leave users with the expectation that only the documents that match the filter are deleted, which was never the case. To address all this confusion, delete index api works now only against concrete indices. Wildcard expressions will be only resolved against concrete indices, as if aliases didn't exist. If one tries to delete against an alias, an
IndexNotFoundExceptionwill be thrown regardless of whether the alias exists or not, as a concrete index with such a name doesn't exist.Closes #2318