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.
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
978fd51
commit 4031670
Showing
7 changed files
with
109 additions
and
9 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
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,79 @@ | ||
--- | ||
"Remove alias with must_exist": | ||
- 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