-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Fix ESQL index resolution #135826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix ESQL index resolution #135826
Conversation
|
||
public void testInexistentIndexNameWithWildcard() throws IOException { | ||
assertErrorMessages(inexistentIndexNameWithWildcard, getInexistentIndexErrorMessage(), 400); | ||
} |
There was a problem hiding this comment.
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*")))); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
# 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)); |
There was a problem hiding this comment.
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.
This change updates various aspects of ES|QL index resolution including:
Fixes: #114495
Fixes: #127347