-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Fix missing index exception handling #126738
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
Fix missing index exception handling #126738
Conversation
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.
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ComputeService.java:324
- [nitpick] Consider using the negation operator instead of '== false' (i.e. '&& !(ExceptionsHelper.unwrapCause(e) instanceof IndexNotFoundException)') to improve readability.
&& (ExceptionsHelper.unwrapCause(e) instanceof IndexNotFoundException) == false) {
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ClusterComputeHandler.java:94
- [nitpick] Consider replacing '== false' with a negation operator (i.e. '&& !(ExceptionsHelper.unwrapCause(e) instanceof IndexNotFoundException)') to enhance clarity.
&& (ExceptionsHelper.unwrapCause(e) instanceof IndexNotFoundException) == false) {
Hi @smalyshev, I've created a changelog YAML for you. |
… missing indices So we have to drop FILTERED status for now
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
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.
LGTM
@@ -138,32 +138,6 @@ public void testFailed() throws Exception { | |||
assertThat(telemetry.getByRemoteCluster().size(), equalTo(0)); | |||
} | |||
|
|||
// TODO: enable when skip-un patch is merged |
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 just old test we never enabled and we don't really need it anymore, so cleaning it up.
Thanks @smalyshev. I took a look at the issue and I think there are several problems:
I wonder if we should spend more time addressing these inconsistencies rather than fixing the surface issues. I am concerned that more surface fixes could accumulate over time. (@astefan WDYT?) I can give it a try to address these. |
@dnhatn You are right, to make a proper and comprehensive fix we need to change how we call field-caps, and maybe to change field-caps API. This patch is not that fix, it's just a quick plug to unblock progress with partial results. I agree that we should work on fixing this, I am just not sure how long it could take, so if partial results work remains blocked until we finish fixing that, and it takes long, we may have problem wrapping it up in time for 8.19. But if you can think about a fix that we can implement reasonably quickly then it's of course better. That said, I think even after that fix, if we get IndexNotFound in runtime, we probably need to produce an error. I can't see any scenario where we get a missing index and don't want an error? The discrepancy between 400 and 404 is because |
@smalyshev I agree. Let's try this until the end of the week. If we can't find a proper fix, we should proceed with this to unblock the partial results. |
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.
Thinking about this more, I am okay with getting this in now. We can make the proper changes later. Thanks @smalyshev
💔 Backport failed
You can use sqren/backport to manually backport by running |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
* Fix missing index handling for partial-enabled queries (cherry picked from commit 54ef165) # Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ClusterComputeHandler.java
@dnhatn I agree. The difference between field_caps and _search time behavior has surfaced previously in one of your earlier PRs, but with partial results the impact is more severe. I agree that we need to have a clean look at the way we use ignore_unvailable in these two cases; it is likely this was a leftover from ES SQL where ignore_unavailable=true for field_caps might have had a very specific use (one that is, so far, not needed in ES|QL). |
This fixes the issue with missing indices being ignored (see #126275).
I am not in love with this because it looks like a hack, and proper fix would be to move handling of this into verifier on the planning stage, but the way field caps works now it doesn't seem possible without protocol changes.
Also, it doesn't fix the case of
which now seems to be broken regardless of partials being enabled (see #114495)
I think this patch makes sense in any case as from what I understand we never want to ignore missing concrete index, but with proper index resolution fix the only way we should ever encounter it would be if the index is gone between planning and execution stage.