elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.48k stars 8.04k forks source link

[data.search] Move `retrieveResults` handling to client #186145

Open lukasolson opened 3 weeks ago

lukasolson commented 3 weeks ago

Summary:

As part of the effort to minimize the server-side processing of search responses from Elasticsearch, we need to move the handling of retrieveResults to the client.

Background:

In https://github.com/elastic/kibana/pull/179679, we added the ability to display partial results of a long-running search request when it times out (search:timeout advanced setting). When the timeout is hit, prior to sending the DELETE _async_search/{id} request, we send one final request to ES (GET _async_search/{id}). (This is because we poll on the status endpoint GET _async_search/status/{id}, which doesn't perform the merging/calculation on ES side for the most up-to-date results of the specific async search request.)

In order to accomplish this, we added a parameter, retrieveResults, which the client sends to the server-side search strategy, which will bypass the logic that polls on the status endpoint and call the GET _async_search/{id} request directly. Since we are trying to move to a place where we can directly stream the responses back from ES to the browser, we need to move this handling to the client.

elasticmachine commented 3 weeks ago

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)