diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts index 99c578d3ae5ff..5e2ee078f096a 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts @@ -368,6 +368,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D overview: `${KIBANA_DOCS}upgrade-assistant.html`, batchReindex: `${KIBANA_DOCS}batch-start-resume-reindex.html`, remoteReindex: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-from-remote`, + unfreezeApi: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`, reindexWithPipeline: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-with-an-ingest-pipeline`, }, rollupJobs: `${KIBANA_DOCS}data-rollups.html`, diff --git a/src/platform/packages/shared/kbn-doc-links/src/types.ts b/src/platform/packages/shared/kbn-doc-links/src/types.ts index 0e9e2d9e2c25c..7dd06b983902c 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/types.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/types.ts @@ -325,6 +325,7 @@ export interface DocLinks { readonly overview: string; readonly batchReindex: string; readonly remoteReindex: string; + readonly unfreezeApi: string; readonly reindexWithPipeline: string; }; readonly rollupJobs: string; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/common/types.ts b/x-pack/platform/plugins/private/upgrade_assistant/common/types.ts index 03820b7668088..7d614463f4977 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/common/types.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/common/types.ts @@ -237,6 +237,7 @@ export interface EnrichedDeprecationInfo | 'ilm_policies' | 'templates'; isCritical: boolean; + frozen?: boolean; status?: estypes.HealthReportIndicatorHealthStatus; index?: string; correctiveAction?: diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap index 753d8bd7db5da..f790b5173ce61 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap @@ -87,3 +87,116 @@ exports[`ChecklistFlyout renders 1`] = ` `; + +exports[`ChecklistFlyout renders for frozen indices 1`] = ` + + + +

+ + Learn more + , + } + } + /> +

+ + } + > + + Learn more + , + } + } + /> + + +

+ +

+
+ + +
+ + + + + + + + + + + + + + +
+`; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx index fff7a05e0b70a..a895f5fad815d 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx @@ -36,6 +36,7 @@ jest.mock('../../../../../app_context', () => { describe('ChecklistFlyout', () => { const defaultProps = { indexName: 'myIndex', + frozen: false, closeFlyout: jest.fn(), confirmInputValue: 'CONFIRM', onConfirmInputChange: jest.fn(), @@ -67,6 +68,12 @@ describe('ChecklistFlyout', () => { expect(shallow()).toMatchSnapshot(); }); + it('renders for frozen indices', () => { + const props = cloneDeep(defaultProps); + props.frozen = true; + expect(shallow()).toMatchSnapshot(); + }); + it('disables button while reindexing', () => { const props = cloneDeep(defaultProps); props.reindexState.status = ReindexStatus.inProgress; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx index c6ba5ecff25d4..0710d560d7d93 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx @@ -72,11 +72,12 @@ const buttonLabel = (status?: ReindexStatus) => { * Displays a flyout that shows the current reindexing status for a given index. */ export const ChecklistFlyoutStep: React.FunctionComponent<{ + frozen?: boolean; closeFlyout: () => void; reindexState: ReindexState; startReindex: () => void; cancelReindex: () => void; -}> = ({ closeFlyout, reindexState, startReindex, cancelReindex }) => { +}> = ({ frozen, closeFlyout, reindexState, startReindex, cancelReindex }) => { const { services: { api, @@ -197,6 +198,37 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{ }} />

+ {frozen && ( + <> + + } + iconType="iInCircle" + > + + {i18n.translate( + 'xpack.upgradeAssistant.checkupTab.reindexing.flyout.learnMoreLinkLabel', + { + defaultMessage: 'Learn more', + } + )} + + ), + }} + /> + + + + )}

= ({ /> ) : ( { expect(upgradeStatus.totalCriticalDeprecations).toBe(0); }); + it('filters out frozen indices if old index deprecations exist for the same indices', async () => { + esClient.asCurrentUser.migration.deprecations.mockResponse({ + cluster_settings: [], + node_settings: [], + ml_settings: [], + index_settings: { + frozen_index: [ + { + level: 'critical', + message: 'Old index with a compatibility version < 8.0', + url: 'https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.0.html#breaking-changes-8.0', + details: 'This index has version: 7.17.28-8.0.0', + resolve_during_rolling_upgrade: false, + _meta: { reindex_required: true }, + }, + { + level: 'critical', + message: + 'Index [frozen_index] is a frozen index. The frozen indices feature is deprecated and will be removed in version 9.0.', + url: 'https://www.elastic.co/guide/en/elasticsearch/reference/master/frozen-indices.html', + details: + 'Frozen indices must be unfrozen before upgrading to version 9.0. (The legacy frozen indices feature no longer offers any advantages. You may consider cold or frozen tiers in place of frozen indices.)', + resolve_during_rolling_upgrade: false, + }, + ], + }, + data_streams: {}, + // @ts-expect-error not in types yet + ilm_policies: {}, + templates: {}, + }); + + // @ts-expect-error not full interface of response + esClient.asCurrentUser.indices.resolveIndex.mockResponse(resolvedIndices); + + const upgradeStatus = await getESUpgradeStatus(esClient, { + ...featureSet, + }); + + expect([ + ...upgradeStatus.migrationsDeprecations, + ...upgradeStatus.enrichedHealthIndicators, + ]).toHaveLength(1); + expect(upgradeStatus.totalCriticalDeprecations).toBe(1); + }); + it('returns health indicators', async () => { esClient.asCurrentUser.migration.deprecations.mockResponse({ cluster_settings: [], diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/migrations.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/migrations.ts index b3e5c0fbdb8d6..d5f3c3d46ca6b 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/migrations.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/migrations.ts @@ -127,13 +127,13 @@ export const getEnrichedDeprecations = async ( const systemIndicesList = convertFeaturesToIndicesArray(systemIndices.features); - const indexSettingsIndexNames = Object.keys(deprecations.index_settings).map( - (indexName) => indexName! - ); + const indexSettingsIndexNames = Object.keys(deprecations.index_settings); const indexSettingsIndexStates = indexSettingsIndexNames.length ? await esIndicesStateCheck(dataClient.asCurrentUser, indexSettingsIndexNames) : {}; + const deprecationsByIndex = new Map(); + return normalizeEsResponse(deprecations) .filter((deprecation) => { switch (deprecation.type) { @@ -174,10 +174,39 @@ export const getEnrichedDeprecations = async ( indexSettingsIndexStates[deprecation.index!] === 'closed' ? 'index-closed' : undefined; } - const enrichedDeprecation = _.omit(deprecation, 'metadata'); - return { - ...enrichedDeprecation, + const enrichedDeprecation = { + ..._.omit(deprecation, 'metadata'), correctiveAction, }; + + if (deprecation.index) { + const indexDeprecations = deprecationsByIndex.get(deprecation.index) || []; + indexDeprecations.push(enrichedDeprecation); + deprecationsByIndex.set(deprecation.index, indexDeprecations); + } + + return enrichedDeprecation; + }) + .filter((deprecation) => { + if ( + deprecation.index && + deprecation.message.includes(`Index [${deprecation.index}] is a frozen index`) + ) { + // frozen indices are created in 7.x, so they are old / incompatible as well + // reindexing + deleting is required, so no need to bubble up this deprecation in the UI + const indexDeprecations = deprecationsByIndex.get(deprecation.index)!; + const oldIndexDeprecation: EnrichedDeprecationInfo | undefined = indexDeprecations.find( + (elem) => + elem.type === 'index_settings' && + elem.index === deprecation.index && + elem.correctiveAction?.type === 'reindex' + ); + if (oldIndexDeprecation) { + oldIndexDeprecation.frozen = true; + return false; + } + } + + return true; }); };