Skip to content

Commit d116b59

Browse files
committed
Apply skip_un to more cases
1 parent a85a8ac commit d116b59

File tree

1 file changed

+7
-0
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session

1 file changed

+7
-0
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlCCSUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ static boolean returnSuccessWithEmptyResult(EsqlExecutionInfo executionInfo, Exc
100100
return false;
101101
}
102102

103+
// On disconnect error, check whether all remotes are marked as skip_unavailable.
103104
if (e instanceof NoClustersToSearchException || ExceptionsHelper.isRemoteUnavailableException(e)) {
104105
for (String clusterAlias : executionInfo.clusterAliases()) {
105106
if (executionInfo.isSkipUnavailable(clusterAlias) == false
@@ -109,6 +110,12 @@ static boolean returnSuccessWithEmptyResult(EsqlExecutionInfo executionInfo, Exc
109110
}
110111
return true;
111112
}
113+
114+
// If all clusters are skippable remotes, then we can return an empty result.
115+
if (executionInfo.clusterAliases().stream().allMatch(executionInfo::isSkipUnavailable)) {
116+
return true;
117+
}
118+
112119
return false;
113120
}
114121

0 commit comments

Comments
 (0)