Skip to content

Conversation

idegtiarenko
Copy link
Contributor

@idegtiarenko idegtiarenko commented Oct 2, 2025

This change updates various aspects of ES|QL index resolution including:

  • allows empty index resolution for patterns
  • requires every supplied pattern to be resolved
  • fixes various inconsistencies in error reporting

Fixes: #114495
Fixes: #127347

@idegtiarenko idegtiarenko added Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL v9.2.0 labels Oct 2, 2025

public void testInexistentIndexNameWithWildcard() throws IOException {
assertErrorMessages(inexistentIndexNameWithWildcard, getInexistentIndexErrorMessage(), 400);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now wildcards are allowed to expand to empty result set

assertThat(e.getMessage(), containsString("verification_exception"));
assertThat(e.getMessage(), anyOf(containsString("Unknown index [foo]"), containsString("Unknown index [remote_cluster:foo]")));

e = expectThrows(ResponseException.class, () -> runEsql(timestampFilter("gte", "2020-01-01").query(from("foo*"))));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same, foo* can now expand to empty result set

String q = "FROM cluster-a:nomatch*";
String expectedError = "Unknown index [cluster-a:nomatch*]";
expectVerificationExceptionForQuery(q, expectedError, requestIncludeMeta);
expectVerificationExceptionForQuery(q, expectedError, requestIncludeMeta);// TODO this must contain the remote cluster alias
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 we are getting RemoteTransportException with cause IndexNotFoundException with index nonmatch. It is correct, but it does not give me enough information to point out to cluster-a in case there are multiple remotes involved. This is likely needs to be added on FieldCaps side

idegtiarenko and others added 8 commits October 13, 2025 09:11
# Conflicts:
#	x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RequestIndexFilteringTestCase.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/IndexResolver.java
listener.onResponse(new FieldCapabilitiesResponse(Collections.emptyList(), Collections.emptyList()));
}
}
listener.onResponse(new FieldCapabilitiesResponse(new ArrayList<>(indexResponses.values()), failures));
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 our "fork" of Field caps action.
This change actually never completes the listener exceptionally. Instead it always completes it with FieldCapabilitiesResponse containing both responses and failures. This way we could accumulate and report all unresolved indices in esql IndexResolver.

I wonder if we should port this behavior to original Field Caps (likely hidden by returnAllFailures flag or something?

@piergm may be you have an opinion on this. Also cc @nik9000 as he originally forked this part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ES|QL index resolution on planning is broken ES|QL: inconsistent "index not found exception" scenario for "limit 0" queries

2 participants