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}`);