diff --git a/src/plugins/data/public/search/search_strategy/default_search_strategy.ts b/src/plugins/data/public/search/search_strategy/default_search_strategy.ts index 6dde6bfe22e4..6fcb1e6b3e8d 100644 --- a/src/plugins/data/public/search/search_strategy/default_search_strategy.ts +++ b/src/plugins/data/public/search/search_strategy/default_search_strategy.ts @@ -74,24 +74,17 @@ function search({ }: SearchStrategySearchParams) { const abortController = new AbortController(); const searchParams = getSearchParams(config, esShardTimeout); - const es = searchService.__LEGACY.esClient; const promises = searchRequests.map(({ index, body }) => { - const searching = es.search({ index: index.title || index, body, ...searchParams }); - abortController.signal.addEventListener('abort', searching.abort); - return searching.catch(({ response }: any) => JSON.parse(response)); - /* - * Once #44302 is resolved, replace the old implementation with this one - - * const params = { - * index: index.title || index, - * body, - * ...searchParams, - * }; - * const { signal } = abortController; - * return searchService - * .search({ params }, { signal }) - * .toPromise() - * .then(({ rawResponse }) => rawResponse); - */ + const params = { + index: index.title || index, + body, + ...searchParams, + }; + const { signal } = abortController; + return searchService + .search({ params }, { signal }) + .toPromise() + .then(({ rawResponse }) => rawResponse); }); return { searching: Promise.all(promises),