Add CCS Remote Views Detection#143384
Merged
elasticsearchmachine merged 12 commits intoelastic:mainfrom Mar 13, 2026
Merged
Conversation
idegtiarenko
reviewed
Mar 2, 2026
...k/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlResolveFieldsAction.java
Show resolved
Hide resolved
idegtiarenko
reviewed
Mar 2, 2026
...k/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlResolveFieldsAction.java
Outdated
Show resolved
Hide resolved
idegtiarenko
reviewed
Mar 2, 2026
...k/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlResolveFieldsAction.java
Show resolved
Hide resolved
idegtiarenko
requested changes
Mar 2, 2026
9bba074 to
8d8c19f
Compare
elasticsearchmachine
pushed a commit
that referenced
this pull request
Mar 11, 2026
There has been several discussions on this topic since I opened #141050 and @idegtiarenko also mentioned this in #143561 (comment). The issue is that both `resolveViews` and `resolveAliases` are in `WildcardOptions` but are used when resolving both concrete index pattern targets and wildcard targets. This PR moves `resolveViews` from `IndicesOptions.WildcardOptions` into a new `IndicesOptions.IndexAbstractionOptions` record to address this confusing inconsistency. This is in preparation for sending `resolveViews` as a parameter to field caps for remote view resolving where more work will be done to serialize `resolveViews` and not having this in place would make for confusing code. See #143384 for more information on the upcoming serialization of `resolveViews`. **_Note_**: `resolveAliases` is moved in a follow up PR since it's decoupled from the resolveViews changes. #143953 **_Note_**: `IndicesRequest.includeDataStreams()` is the same type of flag as `resolveAliases` and `resolveViews`, it controls whether data streams participate in index resolution. It's a candidate for `IndexAbstractionOptions` but currently lives on `IndicesRequest` (not `IndicesOptions`) and is threaded separately through `IndexNameExpressionResolver.Context` as a constructor parameter. Moving it would touch 60+ files and change the `IndicesRequest` interface. Because of how big that change would be, I have not considered doing that in this PR (or at all).
4f9bdd9 to
b893fc7
Compare
jfreden
commented
Mar 12, 2026
| } | ||
|
|
||
| String clusterAlias() { | ||
| public String clusterAlias() { |
Contributor
Author
There was a problem hiding this comment.
Needed for creating a good error message.
jfreden
commented
Mar 12, 2026
| package org.elasticsearch.xpack.esql.ccq; | ||
|
|
||
| import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
| import org.elasticsearch.test.cluster.FeatureFlag; |
Contributor
Author
There was a problem hiding this comment.
Added a test here to make sure this works end-to-end.
Contributor
There was a problem hiding this comment.
I guess the test you added was testRemoteViewFailsQuery?
jfreden
commented
Mar 12, 2026
| // During CCS, resolveViews is only set on a request from the originating cluster and is therefore only true on a remote cluster | ||
| if (request.indicesOptions().indexAbstractionOptions().resolveViews()) { | ||
| Set<String> localViews = getViews(request.indices(), request.indicesOptions(), request.getResolvedIndexExpressions()); | ||
| if (localViews.isEmpty() == false) { |
Contributor
Author
There was a problem hiding this comment.
We will only pass this point if there are no views on the remote cluster, so it's safe to pass the request on to field caps.
Finding remote views will always result in failure so no need to add any special handling for views in field caps.
Collaborator
|
Hi @jfreden, I've created a changelog YAML for you. |
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/session/EsqlCCSUtilsTests.java
Outdated
Show resolved
Hide resolved
...k/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlResolveFieldsAction.java
Outdated
Show resolved
Hide resolved
...k/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlResolveFieldsAction.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlCCSUtils.java
Show resolved
Hide resolved
idegtiarenko
approved these changes
Mar 13, 2026
server/src/main/java/org/elasticsearch/action/fieldcaps/RemoteViewNotSupportedException.java
Outdated
Show resolved
Hide resolved
szybia
added a commit
to szybia/elasticsearch
that referenced
this pull request
Mar 13, 2026
…elocations * upstream/main: (72 commits) [Test] Randomly disable sequence numbers in CcrTimeSeriesDataStreamsIT (elastic#143930) Fix AsyncSearchIndexServiceTests.testCircuitBreaker failure (elastic#144058) Refine GenerativeIT some more, this time with accounting for some added (elastic#144220) ESQL: Physical Planning on the Lookup Node (elastic#143707) Mute org.elasticsearch.xpack.esql.CsvIT test {csv-spec:approximation.Approximate stats by with zero variance} elastic#144240 Trigger counter metrics in test for delta temporality measurements (elastic#144193) fix capabiltiy approximation_v3 (elastic#144230) [ci] Add PR pipeline for testing ipv6 and fix tests not working with ipv6 (elastic#140473) update (elastic#144095) Make from/to optional in TBUCKET when Kibana timestamp filter is present (elastic#144057) Extract reroute behavior from create-index request classes (elastic#144140) ESQL: Fix release build only failures (elastic#144122) ES|QL query approximation: move sample correction to data node (elastic#144005) Add indexing pressure tracking to OTLP endpoints (elastic#144009) Fix replica writes after _seq_no doc values are pruned (elastic#144180) allow tests to configure supportsLoadingConfig (elastic#144061) [ES|QL] Unmute testGiantTextFieldInSubqueryIntermediateResultsWithSort (elastic#144126) [ESQL][DOCS] Add CPS page (unpublished for moment) (elastic#144206) ESQL: Forbid "load" unmapped_fields for certain commands (elastic#144115) Add CCS Remote Views Detection (elastic#143384) ...
michalborek
pushed a commit
to michalborek/elasticsearch
that referenced
this pull request
Mar 23, 2026
This PR adds detection of ES|QL views on remote clusters during cross-cluster search (CCS) and rejects queries that reference them, since views on remote clusters are not yet supported. The error will tell the user which cluster contained what views and how to fix the issue, for example the query: ``` FROM remote-cluster:logs-* ``` Where `remote-cluster` has a view `logs-nginx` the error message will be: ``` ES|QL does not support views in cross-cluster search. View [logs-nginx] was found on [remote-cluster]. To exclude, use [remote-cluster:-logs-nginx] in the index expression. ``` Since this exception can be avoided by adding exclusions to the query, this exception will ignore [skip unavailable](https://www.elastic.co/docs/explore-analyze/cross-cluster-search#ccs-remote-cluster-setup) to make sure that the remote views issue won't be silently ignored.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds detection of ES|QL views on remote clusters during cross-cluster search (CCS) and rejects queries that reference them, since views on remote clusters are not yet supported.
The error will tell the user which cluster contained what views and how to fix the issue, for example the query:
Where
remote-clusterhas a viewlogs-nginxthe error message will be:Since this exception can be avoided by adding exclusions to the query, this exception will ignore skip unavailable to make sure that the remote views issue won't be silently ignored.