Improve error message when aliases are not supported#25728
Merged
javanna merged 1 commit intoelastic:masterfrom Jul 18, 2017
Merged
Improve error message when aliases are not supported#25728javanna merged 1 commit intoelastic:masterfrom
javanna merged 1 commit intoelastic:masterfrom
Conversation
martijnvg
approved these changes
Jul 17, 2017
Contributor
Author
There was a problem hiding this comment.
I tried to remove this logic but tests start to fail, I will dig deeper another time.
olcbean
reviewed
Jul 17, 2017
Contributor
There was a problem hiding this comment.
Wouldn't it be more in sync with the majority of ES msgs if indices is replaced with index in specify the corresponding concrete indices instead.
Contributor
Author
There was a problem hiding this comment.
but it can be more than one index as an alias can point to multiple indices. Would you change that anyway?
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".
c81501b to
d589052
Compare
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 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 PR improves the error message in case aliases are provided, from an
IndexNotFoundException(404 status code) with "no such index" message, to anIllegalArgumentException(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_indicesis set tofalse. In that case the error remains the generic "404 - no such index". I find it confusing to throw a different error in case it's only the matching aliases (getting ignored) that cause the error.