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> (cherry picked from commit a1e4602)
- Loading branch information
1 parent
334636f
commit 056b9f4
Showing
8 changed files
with
197 additions
and
10 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.11.99" | ||
reason: "introduced in 2.12.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