|
16 | 16 | import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature; |
17 | 17 | import org.elasticsearch.action.admin.indices.get.GetIndexResponse; |
18 | 18 | import org.elasticsearch.action.support.IndicesOptions; |
| 19 | +import org.elasticsearch.action.support.IndicesOptions.Option; |
| 20 | +import org.elasticsearch.action.support.IndicesOptions.WildcardStates; |
19 | 21 | import org.elasticsearch.client.Client; |
20 | 22 | import org.elasticsearch.cluster.metadata.AliasMetaData; |
21 | 23 | import org.elasticsearch.cluster.metadata.MappingMetaData; |
@@ -117,6 +119,10 @@ public boolean equals(Object obj) { |
117 | 119 | } |
118 | 120 | } |
119 | 121 |
|
| 122 | + private static final IndicesOptions INDICES_ONLY_OPTIONS = new IndicesOptions( |
| 123 | + EnumSet.of(Option.ALLOW_NO_INDICES, Option.IGNORE_UNAVAILABLE, Option.IGNORE_ALIASES), EnumSet.of(WildcardStates.OPEN)); |
| 124 | + |
| 125 | + |
120 | 126 | private final Client client; |
121 | 127 | private final String clusterName; |
122 | 128 |
|
@@ -144,7 +150,6 @@ public void resolveNames(String indexWildcard, String javaRegex, EnumSet<IndexTy |
144 | 150 | if (retrieveAliases) { |
145 | 151 | GetAliasesRequest aliasRequest = new GetAliasesRequest() |
146 | 152 | .local(true) |
147 | | - .indices(indices) |
148 | 153 | .aliases(indices) |
149 | 154 | .indicesOptions(IndicesOptions.lenientExpandOpen()); |
150 | 155 |
|
@@ -176,7 +181,7 @@ private void resolveIndices(String[] indices, String javaRegex, GetAliasesRespon |
176 | 181 | .indices(indices) |
177 | 182 | .features(Feature.SETTINGS) |
178 | 183 | .includeDefaults(false) |
179 | | - .indicesOptions(IndicesOptions.lenientExpandOpen()); |
| 184 | + .indicesOptions(INDICES_ONLY_OPTIONS); |
180 | 185 |
|
181 | 186 | client.admin().indices().getIndex(indexRequest, |
182 | 187 | ActionListener.wrap(response -> filterResults(javaRegex, aliases, response, listener), |
|
0 commit comments