From f678b96d82e6820fd4030c0bb9bc85ef2710dd88 Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Fri, 11 Feb 2022 09:34:58 -0500 Subject: [PATCH] [Upgrade Assistant] Update logic for handling reindex failures (#125246) (#125366) --- .../deprecation_types/reindex/flyout/checklist_step.tsx | 2 +- .../server/lib/reindexing/reindex_service.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx index 85d8b260c1b79..1be57d33c935b 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx @@ -109,7 +109,6 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{ )} {(hasFetchFailed || hasReindexingFailed) && ( <> - {reindexState.errorMessage} + )} diff --git a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts index 724b282a87747..3182a74498994 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts @@ -293,12 +293,8 @@ export const reindexServiceFactory = ( // Do any other cleanup work necessary reindexOp = await cleanupChanges(reindexOp); } else { - // Check that it reindexed all documents - const { - body: { count }, - } = await esClient.count({ index: reindexOp.attributes.indexName }); - - if (taskResponse.task.status!.created < count) { + // Check that no failures occurred + if (taskResponse.response?.failures?.length) { // Include the entire task result in the error message. This should be guaranteed // to be JSON-serializable since it just came back from Elasticsearch. throw error.reindexTaskFailed(`Reindexing failed: ${JSON.stringify(taskResponse)}`);