Skip to content
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

Wrong behavior deleting alias #23997

Merged
merged 8 commits into from Jun 6, 2017

Conversation

Projects
None yet
9 participants
@olcbean
Copy link
Contributor

commented Apr 9, 2017

Indices wildcards were resolved against all indices and aliases. And if an alias matched, then all indices with this alias were returned as matching.

In other words

POST /_aliases
{
    "actions" : [
        { "add" : { "index" : "foo_foo", "alias" : "foo" } },
        { "add" : { "index" : "bar_bar", "alias" : "foo" } }
    ]
}
POST /_aliases 
{
  "actions": [
    {
      "remove": {
        "index": "foo*",
        "alias": "foo"
      }
    }
  ]
}

will actually return both indices foo_foo and bar_bar as the common alias foo matched the wildcard. Which led to deleting the alias for both indices.

Related to #23960

Relates to #10106

@elasticmachine

This comment has been minimized.

Copy link
Collaborator

commented Apr 9, 2017

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@jimczi

This comment has been minimized.

Copy link
Member

commented Apr 10, 2017

This looks correct to me but I am not very familiar with aliases.
@martijnvg can you take a look ?

core/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java Outdated
@@ -125,6 +126,47 @@ public void testAll() {
assertThat(newHashSet(resolver.resolve(context, Arrays.asList("_all"))), equalTo(newHashSet("testXXX", "testXYY", "testYYY")));
}

// issue #23960

This comment has been minimized.

Copy link
@jasontedor

jasontedor Apr 10, 2017

Member

In general, I would prefer a straightforward comment explaining the issue being tested. A link to a GitHub issues means that I have to be online and context switch to obtain more information.

This comment has been minimized.

Copy link
@olcbean

olcbean Apr 11, 2017

Author Contributor

@jasontedor Good point! I just followed the lead of another test in this class which is abbreviated only with the issue number.

May I assume that generally a test should be commented with a short description why the test has been introduced (and maybe the issue for further reference)?

This comment has been minimized.

Copy link
@jasontedor

jasontedor Apr 11, 2017

Member

If the test and its purpose is straightforward, I would say that no comment is necessary. If the test is for an tricky bug, or its purpose is unclear, I would say a comment is a necessity.

This comment has been minimized.

Copy link
@olcbean

olcbean Apr 13, 2017

Author Contributor

@jasontedor Thank you for answering a trivial question! I understand this is common sense, but somehow common sense manages to differ between projects... Do you know if there is a resource where the basic coding practices are defined for new comers? If there is, a link will be really appreciated.

This comment has been minimized.

Copy link
@jasontedor

jasontedor Apr 14, 2017

Member

I think a lot of what you're looking for is not written down, it's tribal knowledge that we all accumulate with experience in the project. We explain some straightforward things in the contributing docs but the vast majority of our conventions are not written down (and I think that's okay, we catch them during code review).

core/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java Outdated
@@ -643,6 +643,33 @@ public void testConcreteIndicesWildcardWithNegation() {
assertEquals(0, indexNames.length);
}

// issue #23960

This comment has been minimized.

Copy link
@jasontedor

jasontedor Apr 10, 2017

Member

In general, I would prefer a straightforward comment explaining the issue being tested. A link to a GitHub issues means that I have to be online and context switch to obtain more information.

@nik9000

This comment has been minimized.

Copy link
Contributor

commented Apr 14, 2017

@olcbean olcbean changed the title Wrong behavior deleting alias Wrong behavior deleting alias [WIP] Apr 17, 2017

@olcbean olcbean force-pushed the olcbean:delete_aliases branch Apr 25, 2017

@olcbean olcbean changed the title Wrong behavior deleting alias [WIP] Wrong behavior deleting alias Apr 25, 2017

@olcbean

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2017

The index wildcard is usually resolved against all indices and aliases in the cluster. Only for the index alias action the index wildcard will be resolved only against the indices.

I could have introduced a new IndexOption for this but as this is a corner case I opted for an isolated change.

@javanna javanna assigned javanna and unassigned martijnvg Apr 28, 2017

@javanna javanna self-requested a review Apr 28, 2017

@javanna

This comment has been minimized.

Copy link
Member

commented Apr 28, 2017

hi @olcbean thanks for the PR! I think the same fix would be needed in get alias api (TransportGetAliasesAction) too. Also, the ability the expand wildcards only to indices (leaving aliases out) was discussed before in #2318 (comment) so it could be useful in other places. I would go with adding an index option at this point. It may be a bit more complicated to do but I think after all it would be cleaner. Would you be up for this?

@javanna

This comment has been minimized.

Copy link
Member

commented Apr 28, 2017

To be clear, I would make it an internal only new index option, that is not settable through REST, similar to allowAliasesToMultipleIndices() maybe called ignoreAliases() or something along those lines. All of the existing constants would continue with the current behaviour, but a new constant used only in these couple of apis would set this flag to true. Such a change needs to be made in a backwards compatible manner though, as the index options are serialized over the wire.

@olcbean olcbean force-pushed the olcbean:delete_aliases branch 2 times, most recently May 3, 2017

@olcbean

This comment has been minimized.

Copy link
Contributor Author

commented May 3, 2017

@javanna thank you for your feedback and putting this into prospective :)
I just introduced a new IndicesOption ( ignoreAliases ) as you suggested.

However I am not really sure that with this change the #2318 can be solved directly. According to a later comment in the very same thread #2318 (comment)

expand wildcards to aliases and concrete indices. If any aliases are present, throw an exception

but with the new option all wildcards will be resolved only to indices, so no exception can possibly be thrown. Do you think that this is an acceptable deviation from the described behavior?

@javanna

This comment has been minimized.

Copy link
Member

commented May 3, 2017

Do you think that this is an acceptable deviation from the described behavior?

Yes, the reason why we went that route is that I was against introducing a new index option at the time, but given that we need in it in more than in one place now, I changed my mind :)

@javanna
Copy link
Member

left a comment

thanks for the PR @olcbean . I reviewed it and left some comments

core/src/main/java/org/elasticsearch/action/support/IndicesOptions.java Outdated
public boolean ignoreAliases() {
return (id & IGNORE_ALIASES) != 0;
}

public void writeIndicesOptions(StreamOutput out) throws IOException {
out.write(id);

This comment has been minimized.

Copy link
@javanna

javanna May 8, 2017

Member

this method and the read need to handle backwards compatibility: see 7548b2e for a similar change with bw comp layer from when we added allowAliasesToMultipleIndices

core/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java Outdated
@@ -61,7 +61,7 @@

//indices options that require every specified index to exist, expand wildcards only to open indices and
//don't allow that no indices are resolved from wildcard expressions
private static final IndicesOptions INDICES_OPTIONS = IndicesOptions.fromOptions(false, false, true, false);
private static final IndicesOptions INDICES_OPTIONS = IndicesOptions.fromOptions(false, false, true, false, true, false, true);

This comment has been minimized.

Copy link
@javanna

javanna May 8, 2017

Member

I think that we have to change also the default value for GetAliasesRequest ?

This comment has been minimized.

Copy link
@olcbean

olcbean May 11, 2017

Author Contributor

Oh.. I was considering to leave the changes to GetAliasesRequest for another PR ( for better traceability ). But np, I will include them in this one.

This comment has been minimized.

Copy link
@javanna

javanna May 12, 2017

Member

I am fine either way, if you prefer you can send another followup PR to address that.

core/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java Outdated
if (context.getOptions().ignoreAliases()) {
return subMap.entrySet().stream()
.filter(p -> !p.getValue().isAlias())
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));

This comment has been minimized.

Copy link
@javanna

javanna May 8, 2017

Member

nit: replace the lambda expressions with method references? Map.Entry::getKey and Map.Entry::getValue ?

core/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java Outdated
final String pattern = expression;
return metaData.getAliasAndIndexLookup()
.entrySet()
.stream()
.filter(e -> context.getOptions().ignoreAliases() ? !e.getValue().isAlias() : true)

This comment has been minimized.

Copy link
@javanna

javanna May 8, 2017

Member

.filter(e -> context.getOptions().ignoreAliases() == false || e.getValue().isAlias() == false) ?

@@ -625,7 +626,7 @@ boolean isPreserveAliases() {
}

final IndexMetaData.State excludeState = excludeState(options);
final Map<String, AliasOrIndex> matches = matches(metaData, expression);
final Map<String, AliasOrIndex> matches = matches(context, metaData, expression);

This comment has been minimized.

Copy link
@javanna

javanna May 8, 2017

Member

here we are fixing wildcard matching, but shouldn't we also honour the new option when resolving provided concrete names? e.g. what if I specify an alias amongst the indices, that are supposed to be concrete indices names only? I think if we fix this, it would also help with #10106 as we would not allow to create an alias that points to another alias anymore (which does not do what users think it does).

@@ -643,6 +644,51 @@ public void testConcreteIndicesWildcardWithNegation() {
assertEquals(0, indexNames.length);
}

This comment has been minimized.

Copy link
@javanna

javanna May 8, 2017

Member

can you also add tests for the new option when resolving expressions that don't contain wildcards?

core/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java Outdated
@@ -643,6 +644,51 @@ public void testConcreteIndicesWildcardWithNegation() {
assertEquals(0, indexNames.length);
}

// concreteIndexNames must be able to resolve the provided wildcard only against the defined
// indices when ignoreAliases option is set or against the defined indices and aliases otherwise

This comment has been minimized.

Copy link
@javanna

javanna May 8, 2017

Member

I tend to think that this comment is not needed. Maybe add a small comment close to where you create the two indices options?

core/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java Outdated
@@ -125,6 +126,50 @@ public void testAll() {
assertThat(newHashSet(resolver.resolve(context, Arrays.asList("_all"))), equalTo(newHashSet("testXXX", "testXYY", "testYYY")));
}

// WildcardExpressionResolver must be able to resolve the provided wildcard only against the
// defined indices when ignoreAliases option is set or against the defined indices and aliases
// otherwise

This comment has been minimized.

Copy link
@javanna

javanna May 8, 2017

Member

same as above.

core/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java Outdated
equalTo(newHashSet("foo_foo")));

}

This comment has been minimized.

Copy link
@javanna

javanna May 8, 2017

Member

would you mind adding a couple of integration tests to IndexAliasesIT also? Maybe test both IndicesAliasesRequest and GetAliasesRequest ?

@olcbean

This comment has been minimized.

Copy link
Contributor Author

commented May 14, 2017

@javanna thank you for the review!

I hope the latest commit addresses the raised concerns ;)

@javanna
Copy link
Member

left a comment

Hi @olcbean thanks a lot for updating, I did another review round, it looks very good, I left some more comments but nothing major, it's getting close!

core/src/main/java/org/elasticsearch/action/support/IndicesOptions.java Outdated
@@ -120,12 +121,16 @@ public boolean ignoreAliases() {
}

public void writeIndicesOptions(StreamOutput out) throws IOException {
out.write(id);
if (out.getVersion().onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED)) {

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

not sure why this is still mark unreleased, we have already released alpha1, I think you should use alpha2.

This comment has been minimized.

Copy link
@olcbean

olcbean May 17, 2017

Author Contributor

I will need to rebase to see alpha2 ;)

This comment has been minimized.

Copy link
@javanna

javanna May 17, 2017

Member

oh good point, maybe leave that as the last change then so it doesn't mess up the diffs for review :)

core/src/main/java/org/elasticsearch/action/support/IndicesOptions.java Outdated
if (out.getVersion().onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED)) {
out.write(id);
} else {
out.write(id & 0x3f);

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

can you add a comment on what this does and why for future reference?

core/src/main/java/org/elasticsearch/action/support/IndicesOptions.java Outdated
public void writeIndicesOptions(StreamOutput out) throws IOException {
out.write(id);
if (out.getVersion().onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED)) {

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

can you expand IndicesOptionsTests#testSerialization to pass in also the ignoreAliases flag when creating the random indices options and check that they get written/read correctly. You will need an if based on the version there as well.

forbidClosedIndices, false);
}

public static IndicesOptions fromOptions(boolean ignoreUnavailable, boolean allowNoIndices, boolean expandToOpenIndices,

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

can you expand IndicesOptionsTests#testFromOptions using and testing this new flag too?

core/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java Outdated
SortedMap<String,AliasOrIndex> subMap = metaData.getAliasAndIndexLookup().subMap(fromPrefix, toPrefix);
if (context.getOptions().ignoreAliases()) {
return subMap.entrySet().stream()
.filter(p -> !p.getValue().isAlias())

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

can you do here as well p.getValue().isAlias() == false ?

core/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java Outdated
assertTrue(indexNames.contains("bar_bar"));

indexNames = Arrays.asList(indexNameExpressionResolver.concreteIndexNames(state, indicesAndAliasesOptions, "foo"));

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

can you remove the empty lines between assigning indexNames the corresponding assertions? Also above? If you want to divide this into blocks you could also do:

{
    List<String> indexNames = Arrays.asList(indexNameExpressionResolver.concreteIndexNames(state, indicesAndAliasesOptions, "foo*"));
    assert.....
}

This way you declare the list each time and it doesn't get reused.

core/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java Outdated
// when ignoreAliases option is not set, WildcardExpressionResolver resolves the provided
// expressions against the defined indices and aliases
IndicesOptions indicesAndAliasesOptions = IndicesOptions.fromOptions(false, false, true, false, true, false, false);
IndexNameExpressionResolver.Context context = new IndexNameExpressionResolver.Context(state, indicesAndAliasesOptions);

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

could you rename this to highlight what it holds? contextIndicesAndAliases?

core/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java Outdated
// ignoreAliases option is set, WildcardExpressionResolver resolves the provided expressions
// only against the defined indices
IndicesOptions ignoreAliasesOptions = IndicesOptions.fromOptions(false, false, true, false, true, false, true);
IndexNameExpressionResolver.Context contextIndices = new IndexNameExpressionResolver.Context(state, ignoreAliasesOptions);

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

contextIndicesOnly ?

core/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java Outdated
@@ -177,6 +178,9 @@ public IndexNameExpressionResolver(Settings settings) {
final Set<Index> concreteIndices = new HashSet<>(expressions.size());
for (String expression : expressions) {
AliasOrIndex aliasOrIndex = metaData.getAliasAndIndexLookup().get(expression);
if (context.getOptions().ignoreAliases() && aliasOrIndex.isAlias()) {
aliasOrIndex = null;
}
if (aliasOrIndex == null) {

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

I'd change change this to if (aliasOrIndex == null || (aliasOrIndex.isAlias() && context.getOptions().ignoreAliases())) and remove the new if above

core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java Outdated
assertThat(admin().indices().prepareAliasesExist("foo").setIndices("foo_foo").get().exists(), equalTo(false));
assertThat(admin().indices().prepareAliasesExist("foo").setIndices("bar_bar").get().exists(), equalTo(true));
expectThrows(IndexNotFoundException.class, () -> admin().indices().prepareAliases()
.addAliasAction(AliasActions.remove().index("foo").alias("foo")).execute().actionGet());
}

This comment has been minimized.

Copy link
@javanna

javanna May 15, 2017

Member

can you also add a test that makes sure that when adding an alias, you can not make it point to another alias anymore as the indices get resolved to indices only?

@olcbean

This comment has been minimized.

Copy link
Contributor Author

commented May 17, 2017

@javanna thank you for your remarks! I will integrate them later in the week.

Just one more question : do I need to modify some documentation as well ( maybe indices.asciidoc )?

@javanna

This comment has been minimized.

Copy link
Member

commented May 17, 2017

very good point @olcbean . A note on the migrate guide would be nice, although we are fixing a bug. We are introducing a change in the behaviour of get aliases and indices aliases api so better be on the safe side and list it there.

@olcbean olcbean force-pushed the olcbean:delete_aliases branch May 18, 2017

@olcbean olcbean force-pushed the olcbean:delete_aliases branch to 45f83a5 May 28, 2017

@olcbean

This comment has been minimized.

Copy link
Contributor Author

commented May 28, 2017

@javanna, I just pushed some more changes. Hopefully the last round ;)

@javanna javanna added >breaking-java and removed v5.5.0 labels Jun 2, 2017

@javanna javanna merged commit 0d5f395 into elastic:master Jun 6, 2017

1 check passed

CLA Commit author has signed the CLA
Details
@javanna

This comment has been minimized.

Copy link
Member

commented Jun 6, 2017

Thanks a lot @olcbean for the great work, I just merged this.

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jun 6, 2017

Merge branch 'master' into get-aliases-not-found
* master:
  Add support for clear scroll to high level REST client (elastic#25038)
  Tiny correction in inner-hits.asciidoc (elastic#25066)
  Added release notes for 6.0.0-alpha2
  Expand index expressions against indices only when managing aliases (elastic#23997)
  Collapse inner hits rest test should not skip 5.x
  Settings: Fix secure settings by prefix (elastic#25064)
  add `exclude_keys` option to KeyValueProcessor (elastic#24876)
  Test: update missing body tests to run against versions >= 5.5.0
  Track EWMA[1] of task execution time in search threadpool executor
  Removes an invalid assert in resizing big arrays which does not always hold (resizing can result in a smaller size than the current size, while the assert attempted to verify the new size is always greater than the current).
  Fixed NPEs caused by requests without content. (elastic#23497)
  Plugins can register pre-configured char filters (elastic#25000)
  Build: Allow preserving shared dir (elastic#24962)
  Tests: Make secure settings available from settings builder for tests (elastic#25037)

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jun 6, 2017

Merge branch 'master' into fix-get-mapping-head
* master: (1210 commits)
  Add support for clear scroll to high level REST client (elastic#25038)
  Tiny correction in inner-hits.asciidoc (elastic#25066)
  Added release notes for 6.0.0-alpha2
  Expand index expressions against indices only when managing aliases (elastic#23997)
  Collapse inner hits rest test should not skip 5.x
  Settings: Fix secure settings by prefix (elastic#25064)
  add `exclude_keys` option to KeyValueProcessor (elastic#24876)
  Test: update missing body tests to run against versions >= 5.5.0
  Track EWMA[1] of task execution time in search threadpool executor
  Removes an invalid assert in resizing big arrays which does not always hold (resizing can result in a smaller size than the current size, while the assert attempted to verify the new size is always greater than the current).
  Fixed NPEs caused by requests without content. (elastic#23497)
  Plugins can register pre-configured char filters (elastic#25000)
  Build: Allow preserving shared dir (elastic#24962)
  Tests: Make secure settings available from settings builder for tests (elastic#25037)
  [TEST] Skip wildcard expansion test due to breaking change
  Test that gradle and Java version types match (elastic#24943)
  Include duplicate jar when jarhell check fails
  Change ScriptContexts to use needs instead of uses$. (elastic#25036)
  Change `has_child`, `has_parent` queries and `childen` aggregation to work with the new join field type and at the same time maintaining support for the `_parent` meta field type.
  Remove comma-separated feature parsing for GetIndicesAction
  ...

jasontedor added a commit to zeha/elasticsearch that referenced this pull request Jun 6, 2017

Merge branch 'master' into honor-systemd-sysctl-masking
* master: (619 commits)
  Add support for clear scroll to high level REST client (elastic#25038)
  Tiny correction in inner-hits.asciidoc (elastic#25066)
  Added release notes for 6.0.0-alpha2
  Expand index expressions against indices only when managing aliases (elastic#23997)
  Collapse inner hits rest test should not skip 5.x
  Settings: Fix secure settings by prefix (elastic#25064)
  add `exclude_keys` option to KeyValueProcessor (elastic#24876)
  Test: update missing body tests to run against versions >= 5.5.0
  Track EWMA[1] of task execution time in search threadpool executor
  Removes an invalid assert in resizing big arrays which does not always hold (resizing can result in a smaller size than the current size, while the assert attempted to verify the new size is always greater than the current).
  Fixed NPEs caused by requests without content. (elastic#23497)
  Plugins can register pre-configured char filters (elastic#25000)
  Build: Allow preserving shared dir (elastic#24962)
  Tests: Make secure settings available from settings builder for tests (elastic#25037)
  [TEST] Skip wildcard expansion test due to breaking change
  Test that gradle and Java version types match (elastic#24943)
  Include duplicate jar when jarhell check fails
  Change ScriptContexts to use needs instead of uses$. (elastic#25036)
  Change `has_child`, `has_parent` queries and `childen` aggregation to work with the new join field type and at the same time maintaining support for the `_parent` meta field type.
  Remove comma-separated feature parsing for GetIndicesAction
  ...

javanna added a commit to javanna/elasticsearch that referenced this pull request Jun 16, 2017

Delete index API to work only against concrete indices
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

javanna added a commit that referenced this pull request Jun 16, 2017

Delete index API to work only against concrete indices (#25268)
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 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 #2318

@olcbean olcbean deleted the olcbean:delete_aliases branch Jul 10, 2017

javanna added a commit to javanna/elasticsearch that referenced this pull request Jul 11, 2017

Log deprecation warning when aliasing aliases
Support for providing aliases in the index side of update aliases, put alias and delete alias API will be removed in 6.0. This commit adds a deprecation warning for update aliases, put alias or delete alias request that specifies aliases, or wildcard expressions that match aliases, on their index side.

Relates to elastic#23997

javanna added a commit to javanna/elasticsearch that referenced this pull request Jul 17, 2017

Improve error message when aliases are not supported
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

Improve error message when aliases are not supported (#25728)
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".

@colings86 colings86 added v6.0.0-beta1 and removed v6.0.0 labels Jul 31, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.