Skip to content

Conversation

dnhatn
Copy link
Member

@dnhatn dnhatn commented Aug 18, 2025

Backports the following commits to 9.1:

Async queries in EQL and ES|QL do not create an initial response, and 
the current logic does not correctly handle expiration updates when the
query has already completed.

With initial response (no change): First, update the expiration in the 
async index, then update the task's expiration if the task still exists.

Without initial response: First, try to update the task's expiration, 
then attempt to get the result from the task or async index. If the
result is no longer available from the task, update the expiration in
the async index before retrieving it (similar to the initial response
case). This second step was introduced in this fix.

Ideally, we should always create the initial response up front to unify 
the logic for both async_search and async_query, but this fix is
preferred for now as it is more contained.

When reviewing the code, I also found a race condition where async-get 
can return a NOT_FOUND error if the task completes but has not yet
stored its result in the async index. This issue would also be resolved
by storing an initial response up front. I will open a follow-up issue
for it.

Closes elastic#130619
@dnhatn dnhatn added :Analytics/ES|QL AKA ESQL >bug auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Aug 18, 2025
@elasticsearchmachine elasticsearchmachine merged commit 87d3d0b into elastic:9.1 Aug 18, 2025
34 checks passed
@dnhatn dnhatn deleted the backport/9.1/pr-133021 branch August 18, 2025 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.1.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants