Skip to content

Conversation

@idegtiarenko
Copy link
Contributor

Today we populate cross cluster state in esql execution info before performing main field caps.

This has several issues:

  • it is populated from merged across different views main index patterns. This could Result in incorrect set of remotes when multiple patterns have exclusions in them (for example logs-*,-*2024 + metrics-*,-*2025 would incorrectly exclude logs-2025 and metrics-2024. This in turn can exclude the entire remote if those are the only indices on it).
  • This performs org.elasticsearch.indices.IndicesExpressionGrouper#groupIndices that could not correctly expand flat/cps expressions.

This change moves cross cluster info population to after main field caps result is received.

@idegtiarenko idegtiarenko added >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL v9.3.0 labels Oct 29, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

preAnalysis.useAggregateMetricDoubleWhenNotSupported(),
preAnalysis.useDenseVectorWhenNotSupported(),
listener.delegateFailureAndWrap((l, indexResolution) -> {
EsqlCCSUtils.initCrossClusterInfo(indicesExpressionGrouper, verifier.licenseState(), indexPattern, executionInfo);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the state will be populated from field caps resolvedTo data structure if that is available.
We will keep existing approach for responses from older clusters that do not have this information available.

final String indexExpr = Strings.arrayToCommaDelimitedString(entry.getValue().indices());
groupedIndices.forEach((clusterAlias, indexGroup) -> {
executionInfo.swapCluster(clusterAlias, (k, v) -> {
assert v == null : "No cluster for " + clusterAlias + " should have been added to ExecutionInfo yet";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not longer the case. We could have 2 distinct views targeting the same remote. In such case, their expressions are going to be concatenated.

@idegtiarenko idegtiarenko marked this pull request as draft November 3, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants