make get alias expand to open and closed indices by default

This change affects get alias, get aliases as well as cat aliases. They all return closed indices too by default. get alias and get aliases also allow to return open indices only through the `expand_wildcards` option (set it to `open`).

Closes #14982
This commit is contained in:
javanna 2016-01-13 12:46:18 +01:00 committed by Luca Cavanna
parent dc51dd0056
commit 07a82d0c09
3 changed files with 51 additions and 1 deletions

View File

@ -35,7 +35,7 @@ public class GetAliasesRequest extends MasterNodeReadRequest<GetAliasesRequest>
private String[] indices = Strings.EMPTY_ARRAY;
private String[] aliases = Strings.EMPTY_ARRAY;
private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpen();
private IndicesOptions indicesOptions = IndicesOptions.strictExpand();
public GetAliasesRequest(String[] aliases) {
this.aliases = aliases;

View File

@ -188,3 +188,31 @@
index \s+ alias \n
test \s+ test_1 \n
$/
---
"Alias against closed index":
- do:
indices.create:
index: test_index
body:
aliases:
test_alias: {}
- do:
indices.close:
index: test_index
- do:
cat.aliases: {}
- match:
$body: |
/^
test_alias \s+
test_index \s+
- \s+
- \s+
- \s+
$/

View File

@ -205,3 +205,25 @@ setup:
- is_true: test_index
- is_true: test_index_2
---
"Get alias against closed indices":
- do:
indices.close:
index: test_index_2
- do:
indices.get_alias:
name: test_alias
- is_true: test_index
- is_true: test_index_2
- do:
indices.get_alias:
name: test_alias
expand_wildcards: open
- is_true: test_index
- is_false: test_index_2