Skip to content

Delay partial results#141073

Merged
chrisparrinello merged 59 commits intoelastic:mainfrom
chrisparrinello:delay_partial_results
Feb 17, 2026
Merged

Delay partial results#141073
chrisparrinello merged 59 commits intoelastic:mainfrom
chrisparrinello:delay_partial_results

Conversation

@chrisparrinello
Copy link
Copy Markdown
Contributor

Closes #139828.

Implements a new query param, partial_results, on _async_search/{id} to not calculate or return partial results if the query is still running. The query param defaults to true if not specified in the request. If partial_results is true and the search is still running, the search response will include any hits and partial aggregations that are available. If partial_results is false and the search is still running, the search response will not include any hits (but possibly include total hits) nor will include any partial aggregations.

Once the search is complete, the response will include the final results if successful or the partial results in the case of a failure. This is the same behavior as before the implementation of the partial_results query param.

@chrisparrinello chrisparrinello marked this pull request as ready for review February 2, 2026 16:09
@elasticsearchmachine elasticsearchmachine added the needs:triage Requires assignment of a team area label label Feb 2, 2026
@chrisparrinello chrisparrinello added >enhancement Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch and removed needs:triage Requires assignment of a team area label labels Feb 2, 2026
Copy link
Copy Markdown
Contributor

@quux00 quux00 left a comment

Choose a reason for hiding this comment

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

Minor nit left on code comments and request to remove the changes to SearchResponseMerger (communicated via DM). After that I think I can approve.

int totalShards = numShards + numSkippedShards;

// Ensure that given partial results from shard searches, the result we send to the listeners does not contain partial results
// because partialResultsSupressed is set to true. Passing partialResultsSupressed set to true in the assertCompletionListeners
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: "partialResultsSupressed" is misspelled twice here and in the comments below.

Copy link
Copy Markdown
Contributor

@quux00 quux00 left a comment

Choose a reason for hiding this comment

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

LGTM

@chrisparrinello chrisparrinello merged commit 6fc5e7b into elastic:main Feb 17, 2026
35 checks passed
chrisparrinello added a commit that referenced this pull request Feb 23, 2026
…ts (#142875)

Change from partial_results to return_intermediate_results

#141073 introduced a new query parameter to allow clients to decide whether or not intermediate results should be returned when getting async search results if the query is not complete. The initial Github issue asked for a partial_results query parameter but it was decided to change it to return_intermediate_results. That change was made in the PR in all places except for RestGetAsyncSearchAction. This PR corrects that oversight.
jdconrad pushed a commit to jdconrad/elasticsearch that referenced this pull request Feb 24, 2026
…ts (elastic#142875)

Change from partial_results to return_intermediate_results

elastic#141073 introduced a new query parameter to allow clients to decide whether or not intermediate results should be returned when getting async search results if the query is not complete. The initial Github issue asked for a partial_results query parameter but it was decided to change it to return_intermediate_results. That change was made in the PR in all places except for RestGetAsyncSearchAction. This PR corrects that oversight.
sidosera pushed a commit to sidosera/elasticsearch that referenced this pull request Feb 24, 2026
…ts (elastic#142875)

Change from partial_results to return_intermediate_results

elastic#141073 introduced a new query parameter to allow clients to decide whether or not intermediate results should be returned when getting async search results if the query is not complete. The initial Github issue asked for a partial_results query parameter but it was decided to change it to return_intermediate_results. That change was made in the PR in all places except for RestGetAsyncSearchAction. This PR corrects that oversight.
@chrisparrinello chrisparrinello deleted the delay_partial_results branch April 3, 2026 15:21
drewdaemon added a commit to elastic/kibana that referenced this pull request Apr 10, 2026
## Summary

Close #229903
Close #186145

This PR implements two key (async) search performance optimizations
related to polling.
1. When the browser is using a protocol which supports multiplexing,
Kibana-side sleeps are eliminated and long-polling is used, ensuring
results are delivered as soon as possible.
2. One of the Elasticsearch requests that used to happen after polling
has been removed.

## Reviewer notes

`retrieveResults` has been renamed to `returnIntermediateResults` to
match the Elasticsearch [parameter
name](elastic/elasticsearch#141073), but should
be functionally identical.

## Settings behavior

### `wait_for_completion_timeout`

```mermaid
  flowchart TD
      Start[Start] --> Phase{Phase?}

      Phase -->|Initial Submit| SubmitConfig[Use search.asyncSearch.waitForCompletion]

      Phase -->|Polling GET| ClientConfig{search.asyncSearch.pollLength set?}

      ClientConfig -->|Yes - Number| UseClientConfig[Use config value]
      ClientConfig -->|No| Multiplex{Is the browser using HTTP/2 or<br/>HTTP/3?}

      Multiplex -->|Yes| Use30s[Use 30000ms]
      Multiplex -->|No| Undefined[Omitted - functionally zero]
```

### `pollInterval`

```mermaid
  flowchart TD
      Start[Start] --> ConfigSet{search.asyncSearch.pollInterval set?}

      ConfigSet -->|Yes| UseConfig[Use config value]
      ConfigSet -->|No| CheckMultiplex{HTTP/2 or<br/>HTTP/3?}

      CheckMultiplex -->|Yes| UseZero[Use 0ms]
      CheckMultiplex -->|No| CheckStatic{Static value<br/>provided?}

      CheckStatic -->|Yes| UseStatic[Use that value]
      CheckStatic -->|No| ElapsedTime{Elapsed time?}

      ElapsedTime -->|< 1.5s| Use300[300ms]
      ElapsedTime -->|< 5s| Use1000[1000ms]
      ElapsedTime -->|< 20s| Use2500[2500ms]
      ElapsedTime -->|>= 20s| Use5000[5000ms]
```

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

The main risk is if an on-prem deployment has for some reason configured
aggressive network timeouts and also has HTTP/2 enabled for browser
communication, they may see timeout errors after upgrading.

- has set `elasticsearch.idleSocketTimeout` or `server.socketTimeout` to
a value less than 30 seconds.
- uses a proxy that has a timeout configured at less than 30 seconds.

In all these cases, the user can fix the behavior by raising the
interfering timeouts (preferred) or by tuning down the poll length via
`kibana.yml`.

### Release note

Sped up fetching Elasticsearch data for setups using HTTP/2 as the
browser's communication protocol.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Stratou <efstratia.kalafateli@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search Foundations/Search Catch all for Search Foundations Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow delaying partial results in GET /_async_search/{id}

6 participants