Skip to content

Commit cd62a29

Browse files
committed
Hoist this options-checking code
1 parent 9bc08ee commit cd62a29

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

server/src/main/java/org/elasticsearch/cluster/metadata/IndexAbstractionResolver.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ public static boolean isIndexVisible(
156156
final boolean isHidden = indexAbstraction.isHidden();
157157
boolean isVisible = isHidden == false || indicesOptions.expandWildcardsHidden() || isVisibleDueToImplicitHidden(expression, index);
158158
if (indexAbstraction.getType() == IndexAbstraction.Type.ALIAS) {
159-
if (indexAbstraction.isSystem()) {
159+
// it's an alias, ignore expandWildcardsOpen and expandWildcardsClosed.
160+
// it's complicated to support those options with aliases pointing to multiple indices...
161+
isVisible = isVisible && indicesOptions.ignoreAliases() == false;
162+
163+
if (isVisible && indexAbstraction.isSystem()) {
160164
// check if it is net new
161165
if (resolver.getNetNewSystemIndexPredicate().test(indexAbstraction.getName())) {
162166
// don't give this code any particular credit for being *correct*. it's just trying to resolve a combination of
@@ -182,9 +186,6 @@ public static boolean isIndexVisible(
182186
}
183187
}
184188

185-
// it's an alias, ignore expandWildcardsOpen and expandWildcardsClosed.
186-
// complicated to support those options with aliases pointing to multiple indices...
187-
isVisible = isVisible && indicesOptions.ignoreAliases() == false;
188189
if (isVisible && selectorString != null) {
189190
// Check if a selector was present, and if it is, check if this alias is applicable to it
190191
IndexComponentSelector selector = IndexComponentSelector.getByKey(selectorString);

0 commit comments

Comments
 (0)