Skip to content

Commit

Permalink
Use new search strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Mar 1, 2020
1 parent 5b532ff commit d95b947
Showing 1 changed file with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit d95b947

Please sign in to comment.