Skip to content

Commit cd388ae

Browse files
Apply review comments
1 parent b3c3f9d commit cd388ae

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ static <T> boolean isExplicitAllPattern(Collection<T> aliasesOrIndices, Function
14331433
/**
14341434
* Identifies if this expression list is *,-* which effectively means a request that requests no indices.
14351435
*/
1436-
static boolean isNoneExpression(String[] expressions) {
1436+
public static boolean isNoneExpression(String[] expressions) {
14371437
return expressions.length == 2 && "*".equals(expressions[0]) && "-*".equals(expressions[1]);
14381438
}
14391439

server/src/main/java/org/elasticsearch/transport/RemoteClusterService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.elasticsearch.action.support.PlainActionFuture;
2020
import org.elasticsearch.action.support.RefCountingRunnable;
2121
import org.elasticsearch.client.internal.RemoteClusterClient;
22+
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
2223
import org.elasticsearch.cluster.node.DiscoveryNode;
2324
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
2425
import org.elasticsearch.common.Strings;
@@ -206,13 +207,12 @@ public Map<String, OriginalIndices> groupIndices(
206207
* We could use IndicesAndAliasesResolverField.NO_INDICES_OR_ALIASES_ARRAY but that'd require adding dependency on its
207208
* module and doing so results in a circular dependency warnings.
208209
*/
209-
if (indices.length == 2 && indices[0].equals("*") && indices[1].equals("-*")) {
210+
if (returnLocalAll == false && IndexNameExpressionResolver.isNoneExpression(indices)) {
210211
groupedIndices = Map.of();
211212
/*
212213
* We set returnLocalAll to false because this semantic ["*", "-*"] specifically means that it's alright to return
213214
* an empty response and in this context we do not want to fallback to the local cluster.
214215
*/
215-
returnLocalAll = false;
216216
} else {
217217
groupedIndices = groupClusterIndices(remoteClusterNames, indices);
218218
}

0 commit comments

Comments
 (0)