forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix remove alias with must_exist (elastic#65141)
Remove alias now parses the must_exist flag and results in a 404 (not found), if the index does not have the alias. Closes elastic#62642 Relates elastic#58100 Co-Authored-By: Luca Cavanna <javanna@users.noreply.github.com>
- Loading branch information
1 parent
7c729c4
commit 7a6b7c2
Showing
7 changed files
with
114 additions
and
9 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
rest-api-spec/src/main/resources/rest-api-spec/test/indices.update_aliases/40_must_exist.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
"Remove alias with must_exist": | ||
|
||
- skip: | ||
version: " - 7.10.99" | ||
reason: "must_exist does not work until 7.11" | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
|
||
- do: | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- add: | ||
index: test_index | ||
aliases: test_alias1 | ||
- do: | ||
indices.exists_alias: | ||
name: test_alias1 | ||
- is_true: '' | ||
|
||
- do: | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove: | ||
index: test_index | ||
alias: test_alias1 | ||
must_exist: true | ||
- add: | ||
index: test_index | ||
alias: test_alias2 | ||
- do: | ||
indices.exists_alias: | ||
name: test_alias1 | ||
- is_false: '' | ||
- do: | ||
indices.exists_alias: | ||
name: test_alias2 | ||
- is_true: '' | ||
|
||
- do: | ||
catch: missing | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove: | ||
index: test_index | ||
alias: test_alias1 | ||
must_exist: true | ||
- add: | ||
index: test_index | ||
alias: test_alias3 | ||
- do: | ||
indices.exists_alias: | ||
name: test_alias3 | ||
- is_false: '' | ||
|
||
--- | ||
"Alias must_exist only on remove": | ||
- do: | ||
indices.create: | ||
index: test_index | ||
|
||
- do: | ||
catch: bad_request | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- add: | ||
index: test_index | ||
aliases: test_alias1 | ||
must_exist: true | ||
|
||
- do: | ||
catch: bad_request | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove_index: | ||
index: test_index | ||
must_exist: true |
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
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
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
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
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
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