From 3381dcddab1a718fef3760eed40f13822fd19b7f Mon Sep 17 00:00:00 2001 From: Shenoy Pratik Date: Wed, 30 Oct 2024 19:30:32 -0700 Subject: [PATCH] [Discover] Fix error handling for ppl jobs API (#8771) * fix error handling for ppl jobs API Signed-off-by: Shenoy Pratik * Changeset file for PR #8771 created/updated --------- Signed-off-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}`);