Skip to content

Commit 00020a3

Browse files
Apply review comments
1 parent bac027a commit 00020a3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,16 @@ public Map<String, OriginalIndices> groupIndices(
203203
) {
204204
final Map<String, OriginalIndices> originalIndicesMap = new HashMap<>();
205205
final Map<String, List<String>> groupedIndices;
206+
/*
207+
* returnLocalAll is used to control whether we'd like to fallback to the local cluster.
208+
* While this is acceptable in a few cases, there are cases where we should not fallback to the local
209+
* cluster. Consider _resolve/cluster where the specified patterns do not match any remote clusters.
210+
* Falling back to the local cluster and returning its details in such cases is not ok. This is why
211+
* TransportResolveClusterAction sets returnLocalAll to false wherever it uses groupIndices().
212+
*
213+
* If such a fallback isn't allowed and the given indices match a pattern whose semantics mean that
214+
* it's ok to return an empty result (denoted via ["*", "-*"]), empty groupIndices.
215+
*/
206216
if (returnLocalAll == false && IndexNameExpressionResolver.isNoneExpression(indices)) {
207217
groupedIndices = Map.of();
208218
} else {

0 commit comments

Comments
 (0)