diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/get_painless_error.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/get_painless_error.ts index 2bbeea9d675c7..100d9cdac133b 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/get_painless_error.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/get_painless_error.ts @@ -23,9 +23,9 @@ import { get } from 'lodash'; export function getPainlessError(error: Error) { const rootCause: Array<{ lang: string; script: string }> | undefined = get( error, - 'resp.error.root_cause' + 'body.attributes.error.root_cause' ); - const message: string = get(error, 'message'); + const message: string = get(error, 'body.message'); if (!rootCause) { return; diff --git a/src/plugins/data/public/search/search_strategy/default_search_strategy.test.ts b/src/plugins/data/public/search/search_strategy/default_search_strategy.test.ts index 80ab7ceb8870f..1915645ad2df2 100644 --- a/src/plugins/data/public/search/search_strategy/default_search_strategy.test.ts +++ b/src/plugins/data/public/search/search_strategy/default_search_strategy.test.ts @@ -117,8 +117,7 @@ describe('defaultSearchStrategy', function() { test('should call new search service', () => { const config = getConfigStub(); search({ ...searchArgs, config }); - expect(searchMock).toHaveBeenCalled(); - expect(newSearchMock).toHaveBeenCalledTimes(0); + expect(newSearchMock).toHaveBeenCalledTimes(1); }); test('should properly abort with new search service', async () => { 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 6dde6bfe22e4a..6fcb1e6b3e8d2 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),