From 543420113443b184e313e489215a88090d60e2b5 Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Thu, 31 Oct 2024 13:28:39 -0700 Subject: [PATCH] [2.x-manual-bp][Discover] Fix error handling for ppl jobs API (#8771) (#8777) Backport PR: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8771 From 8771: * fix error handling for ppl jobs API * Changeset file for PR #8771 created/updated --------- Signed-off-by: Shenoy Pratik Co-authored-by: Shenoy Pratik Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> --- changelogs/fragments/8771.yml | 2 ++ .../server/search/ppl_async_search_strategy.ts | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/8771.yml diff --git a/changelogs/fragments/8771.yml b/changelogs/fragments/8771.yml new file mode 100644 index 000000000000..f923975aface --- /dev/null +++ b/changelogs/fragments/8771.yml @@ -0,0 +1,2 @@ +fix: +- Fix error handling for ppl jobs API ([#8771](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8771)) \ No newline at end of file diff --git a/src/plugins/query_enhancements/server/search/ppl_async_search_strategy.ts b/src/plugins/query_enhancements/server/search/ppl_async_search_strategy.ts index 9ac010b204c0..ede0d51b62c7 100644 --- a/src/plugins/query_enhancements/server/search/ppl_async_search_strategy.ts +++ b/src/plugins/query_enhancements/server/search/ppl_async_search_strategy.ts @@ -59,6 +59,9 @@ export const pplAsyncSearchStrategyProvider = ( } else { request.params = { queryId: inProgressQueryId }; const queryStatusResponse: any = await pplAsyncJobsFacet.describeQuery(context, request); + + if (!queryStatusResponse.success) handleFacetError(queryStatusResponse); + const queryStatus = queryStatusResponse?.data?.status; logger.info(`pplAsyncSearchStrategy: JOB: ${inProgressQueryId} - STATUS: ${queryStatus}`);