forked from opensearch-project/OpenSearch
-
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.
Enable must_exist parameter for update aliases API (opensearch-projec…
…t#11210) * Enable must_exist parameter for update aliases API Signed-off-by: Gao Binlong <gbinlong@amazon.com> * modify changelog Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Fix test failure Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Fix test failure Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Remove silently when all aliases are non-existing and must_exist is false Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Modify some comments to run gradle check again Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Add more yaml test Signed-off-by: Gao Binlong <gbinlong@amazon.com> --------- Signed-off-by: Gao Binlong <gbinlong@amazon.com>
- Loading branch information
1 parent
2a614f0
commit 9108a79
Showing
8 changed files
with
196 additions
and
9 deletions.
There are no files selected for viewing
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
141 changes: 141 additions & 0 deletions
141
...rc/main/resources/rest-api-spec/test/indices.update_aliases/40_remove_with_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,141 @@ | ||
--- | ||
"Throw aliases missing exception when removing non-existing alias with setting must_exist to true": | ||
- skip: | ||
version: " - 2.99.99" | ||
reason: "introduced in 3.0" | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
|
||
- do: | ||
indices.exists_alias: | ||
name: test_alias | ||
|
||
- is_false: '' | ||
|
||
- do: | ||
catch: /aliases \[test_alias\] missing/ | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove: | ||
index: test_index | ||
alias: test_alias | ||
must_exist: true | ||
|
||
- do: | ||
catch: /aliases \[testAlias\*\] missing/ | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove: | ||
index: test_index | ||
aliases: [ testAlias* ] | ||
must_exist: true | ||
|
||
- do: | ||
catch: /\[aliases\] can't be empty/ | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove: | ||
index: test_index | ||
aliases: [] | ||
must_exist: true | ||
|
||
--- | ||
"Throw aliases missing exception when all of the specified aliases are non-existing": | ||
- skip: | ||
version: " - 2.99.99" | ||
reason: "introduced in 3.0" | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
|
||
- do: | ||
indices.exists_alias: | ||
name: test_alias | ||
|
||
- is_false: '' | ||
|
||
- do: | ||
catch: /aliases \[test\_alias\] missing/ | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove: | ||
index: test_index | ||
alias: test_alias | ||
|
||
- do: | ||
catch: /aliases \[test\_alias\*\] missing/ | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove: | ||
indices: [ test_index ] | ||
aliases: [ test_alias* ] | ||
|
||
--- | ||
"Remove successfully when some specified aliases are non-existing": | ||
- skip: | ||
version: " - 2.99.99" | ||
reason: "introduced in 3.0" | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
|
||
- do: | ||
indices.exists_alias: | ||
name: test_alias | ||
|
||
- is_false: '' | ||
|
||
- do: | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- add: | ||
indices: [ test_index ] | ||
aliases: [ test_alias ] | ||
|
||
- do: | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove: | ||
index: test_index | ||
aliases: [test_alias, test_alias1, test_alias2] | ||
must_exist: false | ||
|
||
- match: { acknowledged: true } | ||
|
||
--- | ||
"Remove silently when all of the specified aliases are non-existing and must_exist is false": | ||
- skip: | ||
version: " - 2.99.99" | ||
reason: "introduced in 3.0" | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
|
||
- do: | ||
indices.exists_alias: | ||
name: test_alias | ||
|
||
- is_false: '' | ||
|
||
- do: | ||
indices.update_aliases: | ||
body: | ||
actions: | ||
- remove: | ||
index: test_index | ||
aliases: [test_alias, test_alias1, test_alias2] | ||
must_exist: false | ||
|
||
- match: { acknowledged: 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