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
Throw exception if index
is null or missing when creating an alias
#8240
Closed
Conversation
This file contains 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
The Remove section independently checked the size of indices, but now that it is being checked at the end of verification it is not needed inside the Remove clause
The reason this bug wasn't caught by the existing tests is because the old test for nullness only validated against a cluster which had zero indices. The null index is translated into "_all", and since there are no indices, this fails because the index doesn't exist. However, as soon as you add an index, "_all" resolves and you get the situation described in the original bug report (but which is not tested by the suite).
assertAcked(admin().indices().prepareAliases().addAlias((String) null, "empty-alias")); | ||
fail("create alias should have failed due to null index"); | ||
} catch (ElasticsearchIllegalArgumentException e) { | ||
assertThat(e.getMessage(), equalTo("Validation Failed: 1: Alias action [add]: Property [index] was either missing or null;")); |
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.
Perhaps use a "contains" here instead of exact equality? This is less error prone if the wording is slightly tweaked in the future.
LGTM. I left one minor comment. |
Also add a reason for failure
spalger
pushed a commit
that referenced
this pull request
Oct 28, 2014
spalger
pushed a commit
that referenced
this pull request
Oct 28, 2014
This was merged in f5b2dfd |
clintongormley
changed the title
Aliases: Throw exception if index is null or missing when creating an alias
Throw exception if Jun 6, 2015
index
is null or missing when creating an alias
clintongormley
added
:Data Management/Indices APIs
APIs to create and manage indices and templates
and removed
:Aliases
labels
Feb 13, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
>breaking
:Data Management/Indices APIs
APIs to create and manage indices and templates
v1.5.0
v2.0.0-beta1
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.
Fixes a bug where alias creation would allow
null
for index name, which thereby applied the alias to all indices. This patch makes the validator throw an exception if the index is null.Java integration tests and YAML REST tests had to be modified, since they were testing this bug as if it were a real feature.
This is a breaking change, if someone was accidentally relying on this bug.
Fixes #7863, related to old PR #7976