-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport 2.x] Enable must_exist parameter for update aliases API (#1…
…1210) (#11833) * Enable must_exist parameter for update aliases API (#11210) * Enable must_exist parameter for update aliases API Signed-off-by: Gao Binlong <[email protected]> * modify changelog Signed-off-by: Gao Binlong <[email protected]> * Fix test failure Signed-off-by: Gao Binlong <[email protected]> * Fix test failure Signed-off-by: Gao Binlong <[email protected]> * Remove silently when all aliases are non-existing and must_exist is false Signed-off-by: Gao Binlong <[email protected]> * Modify some comments to run gradle check again Signed-off-by: Gao Binlong <[email protected]> * Add more yaml test Signed-off-by: Gao Binlong <[email protected]> --------- Signed-off-by: Gao Binlong <[email protected]> (cherry picked from commit a1e4602) * Update supported version to 2.12.0 Signed-off-by: Gao Binlong <[email protected]> * Small change to rerun gradle check Signed-off-by: Gao Binlong <[email protected]> --------- Signed-off-by: Gao Binlong <[email protected]>
- Loading branch information
1 parent
166ede7
commit acef38e
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.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 | ||
|
||
- 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.11.99" | ||
reason: "introduced in 2.12.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.11.99" | ||
reason: "introduced in 2.12.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