diff --git a/public/JobHandler/callbacks/force_merge.tsx b/public/JobHandler/callbacks/force_merge.tsx index b1685ec5e..656cea771 100644 --- a/public/JobHandler/callbacks/force_merge.tsx +++ b/public/JobHandler/callbacks/force_merge.tsx @@ -30,14 +30,14 @@ export const callbackForForceMerge: CallbackType = async (job: ForceMergeJobMeta const tasksResult = await commonService.apiCaller({ endpoint: "transport.request", data: { - path: `/.tasks/_doc/${extras.taskId}`, + path: `/_tasks/${extras.taskId}`, method: "GET", }, }); if (tasksResult.ok) { - const { _source, found } = tasksResult.response; - const { completed, error } = (_source || {}) as ForceMergeTaskResult["_source"]; - if (completed && found) { + const _source = tasksResult.response; + const { completed, error } = (_source || {}) as ForceMergeTaskResult; + if (completed) { if (extras.toastId) { core.notifications.toasts.remove(extras.toastId); } diff --git a/public/JobHandler/callbacks/open.tsx b/public/JobHandler/callbacks/open.tsx index 28056345c..4b9c25136 100644 --- a/public/JobHandler/callbacks/open.tsx +++ b/public/JobHandler/callbacks/open.tsx @@ -22,13 +22,13 @@ export const callbackForOpen: CallbackType = async (job: OpenJobMetaData, { core const tasksResult = await commonService.apiCaller({ endpoint: "transport.request", data: { - path: `/.tasks/_doc/${extras.taskId}`, + path: `/_tasks/${extras.taskId}`, method: "GET", }, }); if (tasksResult.ok) { - const { _source } = tasksResult.response; - const { completed, error } = (_source || {}) as OpenTaskResult["_source"]; + const _source = tasksResult.response; + const { completed, error } = (_source || {}) as OpenTaskResult; if (completed) { const { acknowledged, shards_acknowledged } = _source.response || {}; if (acknowledged && shards_acknowledged) { diff --git a/public/JobHandler/callbacks/reindex.tsx b/public/JobHandler/callbacks/reindex.tsx index 16cf3f9a9..6e89cc6b9 100644 --- a/public/JobHandler/callbacks/reindex.tsx +++ b/public/JobHandler/callbacks/reindex.tsx @@ -27,15 +27,15 @@ export const callbackForReindex: CallbackType = async (job: ReindexJobMetaData, const tasksResult = await commonService.apiCaller({ endpoint: "transport.request", data: { - path: `/.tasks/_doc/${extras.taskId}`, + path: `/_tasks/${extras.taskId}`, method: "GET", }, }); if (tasksResult.ok) { - const { _source, found } = tasksResult.response; - const { completed, response, error } = (_source || {}) as ReindexTaskResult["_source"]; + const _source = tasksResult.response; + const { completed, response, error } = (_source || {}) as ReindexTaskResult; const { failures, canceled } = response || {}; - if (completed && found) { + if (completed) { if (extras.toastId) { core.notifications.toasts.remove(extras.toastId); } diff --git a/public/JobHandler/callbacks/shrink.tsx b/public/JobHandler/callbacks/shrink.tsx index 34e90b699..bb3db2a5b 100644 --- a/public/JobHandler/callbacks/shrink.tsx +++ b/public/JobHandler/callbacks/shrink.tsx @@ -17,15 +17,15 @@ export const callbackForShrink: CallbackType = async (job: RecoveryJobMetaData, const tasksResult = await commonService.apiCaller({ endpoint: "transport.request", data: { - path: `/.tasks/_doc/${extras.taskId}`, + path: `/_tasks/${extras.taskId}`, method: "GET", }, }); if (tasksResult.ok) { - const { _source, found } = tasksResult.response; - const { completed, error } = (_source || {}) as TaskResult["_source"]; - if (completed && found) { + const _source = tasksResult.response; + const { completed, error } = (_source || {}) as TaskResult; + if (completed) { if (extras.toastId) { core.notifications.toasts.remove(extras.toastId); } diff --git a/public/JobHandler/callbacks/split.tsx b/public/JobHandler/callbacks/split.tsx index 260a578e0..ff39d60d7 100644 --- a/public/JobHandler/callbacks/split.tsx +++ b/public/JobHandler/callbacks/split.tsx @@ -17,14 +17,14 @@ export const callbackForSplit: CallbackType = async (job: RecoveryJobMetaData, { const tasksResult = await commonService.apiCaller({ endpoint: "transport.request", data: { - path: `/.tasks/_doc/${extras.taskId}`, + path: `/_tasks/${extras.taskId}`, method: "GET", }, }); if (tasksResult.ok) { - const { _source, found } = tasksResult.response; - const { completed, error } = (_source || {}) as TaskResult["_source"]; - if (completed && found) { + const _source = tasksResult.response; + const { completed, error } = (_source || {}) as TaskResult; + if (completed) { if (extras.toastId) { core.notifications.toasts.remove(extras.toastId); } diff --git a/public/JobHandler/interface.ts b/public/JobHandler/interface.ts index 08d42638a..88f015397 100644 --- a/public/JobHandler/interface.ts +++ b/public/JobHandler/interface.ts @@ -13,14 +13,11 @@ export type CallbackType = ( ) => Promise; export type TaskResult = { - found: boolean; - _source: { - completed: boolean; - response: T; - error?: { - type: string; - reason: string; - }; + completed: boolean; + response: T; + error?: { + type: string; + reason: string; }; };