From 09a5e42a1e487c2070cbbf2a852d36027c301ca1 Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Fri, 25 Oct 2024 17:28:35 +0100 Subject: [PATCH 01/14] [Index Management] Add support for index mode --- .../common/types/data_streams.ts | 2 ++ .../template_form/steps/step_review.tsx | 11 ++++++++ .../data_stream_detail_panel.tsx | 12 +++++++++ .../data_stream_list/data_stream_list.tsx | 2 ++ .../data_stream_table/data_stream_table.tsx | 9 +++++++ .../server/lib/data_stream_serialization.ts | 2 ++ .../api/data_streams/register_get_route.ts | 26 ++++++++++++++++++- 7 files changed, 63 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/index_management/common/types/data_streams.ts b/x-pack/plugins/index_management/common/types/data_streams.ts index 78c671969f579..81e31c65c7af2 100644 --- a/x-pack/plugins/index_management/common/types/data_streams.ts +++ b/x-pack/plugins/index_management/common/types/data_streams.ts @@ -45,6 +45,7 @@ export interface EnhancedDataStreamFromEs extends IndicesDataStream { delete_index: boolean; manage_data_stream_lifecycle: boolean; }; + index_mode?: string | null; } export interface DataStream { @@ -71,6 +72,7 @@ export interface DataStream { retention_determined_by?: string; globalMaxRetention?: string; }; + indexMode: string; } export interface DataStreamIndex { diff --git a/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx b/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx index 24544db04498b..51f3933c8e27a 100644 --- a/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx +++ b/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx @@ -268,6 +268,17 @@ export const StepReview: React.FunctionComponent = React.memo( {getDescriptionText(serializedSettings)} + {/* Index settings */} + + + + + {serializedSettings?.index?.mode ?? 'standard'} + + {/* Mappings */} = ({ meteringStorageSize, meteringDocsCount, lifecycle, + indexMode, } = dataStream; const getManagementDetails = () => { @@ -345,6 +346,17 @@ export const DataStreamDetailPanel: React.FunctionComponent = ({ ), dataTestSubj: 'indexTemplateDetail', }, + { + name: i18n.translate('xpack.idxMgmt.dataStreamDetailPanel.indexModeTitle', { + defaultMessage: 'Index mode', + }), + toolTip: i18n.translate('xpack.idxMgmt.dataStreamDetailPanel.indexModeToolTip', { + defaultMessage: + 'The index mode setting of the index template that configured this data stream.', + }), + content: indexMode ?? 'standard', + dataTestSubj: 'indexModeDetail', + }, { name: i18n.translate('xpack.idxMgmt.dataStreamDetailPanel.dataRetentionTitle', { defaultMessage: 'Effective data retention', diff --git a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_list.tsx b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_list.tsx index e2b736305ef3c..ee13f774ee54d 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_list.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_list.tsx @@ -84,6 +84,8 @@ export const DataStreamList: React.FunctionComponent(SHOW_PROJECT_LEVEL_RETENTION, true); diff --git a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx index 927907757fe7b..3a80203818bf1 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx @@ -184,6 +184,15 @@ export const DataStreamTable: React.FunctionComponent = ({ ), }); + columns.push({ + field: 'indexMode', + name: i18n.translate('xpack.idxMgmt.dataStreamList.table.indexModeColumnTitle', { + defaultMessage: 'Index mode', + }), + truncateText: true, + sortable: true, + }); + columns.push({ field: 'lifecycle', name: ( diff --git a/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts b/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts index 2e493ca02aa79..838bd2ebfd26c 100644 --- a/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts +++ b/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts @@ -28,6 +28,7 @@ export function deserializeDataStream(dataStreamFromEs: EnhancedDataStreamFromEs lifecycle, global_max_retention: globalMaxRetention, next_generation_managed_by: nextGenerationManagedBy, + index_mode: indexMode, } = dataStreamFromEs; const meteringStorageSize = meteringStorageSizeBytes !== undefined @@ -73,6 +74,7 @@ export function deserializeDataStream(dataStreamFromEs: EnhancedDataStreamFromEs globalMaxRetention, }, nextGenerationManagedBy, + indexMode: indexMode ?? 'standard', }; } diff --git a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts index 8b62c2b3a25cb..9470958bed3b3 100644 --- a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts @@ -18,7 +18,7 @@ import { deserializeDataStream, deserializeDataStreamList, } from '../../../lib/data_stream_serialization'; -import { EnhancedDataStreamFromEs } from '../../../../common/types'; +import { EnhancedDataStreamFromEs, TemplateSerialized } from '../../../../common/types'; import { RouteDependencies } from '../../../types'; import { addBasePath } from '..'; @@ -31,12 +31,14 @@ const enhanceDataStreams = ({ meteringStats, dataStreamsPrivileges, globalMaxRetention, + indexTemplates, }: { dataStreams: IndicesDataStream[]; dataStreamsStats?: IndicesDataStreamsStatsDataStreamsStatsItem[]; meteringStats?: MeteringStats[]; dataStreamsPrivileges?: SecurityHasPrivilegesResponse; globalMaxRetention?: string; + indexTemplates?: Array<{ name: string; index_template: TemplateSerialized }>; }): EnhancedDataStreamFromEs[] => { return dataStreams.map((dataStream) => { const enhancedDataStream: EnhancedDataStreamFromEs = { @@ -71,6 +73,11 @@ const enhanceDataStreams = ({ } } + const indexTemplate = indexTemplates.find((template) => template.name === dataStream.template); + if (indexTemplate) { + enhancedDataStream.index_mode = indexTemplate.index_template?.template?.settings?.index?.mode; + } + return enhancedDataStream; }); }; @@ -152,11 +159,15 @@ export function registerGetAllRoute({ router, lib: { handleEsError }, config }: ); } + const { index_templates: indexTemplates } = + await client.asCurrentUser.indices.getIndexTemplate(); + const enhancedDataStreams = enhanceDataStreams({ dataStreams, dataStreamsStats, meteringStats, dataStreamsPrivileges, + indexTemplates, }); return response.ok({ body: deserializeDataStreamList(enhancedDataStreams) }); @@ -199,17 +210,30 @@ export function registerGetOneRoute({ router, lib: { handleEsError }, config }: if (dataStreams[0]) { let dataStreamsPrivileges; + let indexTemplates; if (config.isSecurityEnabled()) { dataStreamsPrivileges = await getDataStreamsPrivileges(client, [dataStreams[0].name]); } + if (dataStreams[0].template) { + const { index_templates: templates } = + await client.asCurrentUser.indices.getIndexTemplate({ + name: dataStreams[0].template, + }); + + if (templates) { + indexTemplates = templates; + } + } + const enhancedDataStreams = enhanceDataStreams({ dataStreams, dataStreamsStats, meteringStats, dataStreamsPrivileges, globalMaxRetention, + indexTemplates, }); const body = deserializeDataStream(enhancedDataStreams[0]); return response.ok({ body }); From e7817754397850bbd0baf3a9a94c1d17bdbcaf2d Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Fri, 25 Oct 2024 18:24:00 +0100 Subject: [PATCH 02/14] Add api integration tests and index mode type --- .../common/types/data_streams.ts | 2 ++ .../server/lib/data_stream_serialization.ts | 3 ++- .../index_management/data_streams.ts | 19 +++++++++++++++++++ .../lib/datastreams.helpers.ts | 7 ++++++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/index_management/common/types/data_streams.ts b/x-pack/plugins/index_management/common/types/data_streams.ts index 81e31c65c7af2..00b8685496149 100644 --- a/x-pack/plugins/index_management/common/types/data_streams.ts +++ b/x-pack/plugins/index_management/common/types/data_streams.ts @@ -33,6 +33,8 @@ export type DataStreamIndexFromEs = IndicesDataStreamIndex; export type Health = 'green' | 'yellow' | 'red'; +export type IndexMode = 'standard' | 'logsdb' | 'time_series'; + export interface EnhancedDataStreamFromEs extends IndicesDataStream { global_max_retention?: string; store_size?: IndicesDataStreamsStatsDataStreamsStatsItem['store_size']; diff --git a/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts b/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts index 838bd2ebfd26c..2c5a5019f1730 100644 --- a/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts +++ b/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts @@ -7,6 +7,7 @@ import { ByteSizeValue } from '@kbn/config-schema'; import type { DataStream, EnhancedDataStreamFromEs, Health } from '../../common'; +import { IndexMode } from "@kbn/index-management-plugin/common/types/data_streams"; export function deserializeDataStream(dataStreamFromEs: EnhancedDataStreamFromEs): DataStream { const { @@ -74,7 +75,7 @@ export function deserializeDataStream(dataStreamFromEs: EnhancedDataStreamFromEs globalMaxRetention, }, nextGenerationManagedBy, - indexMode: indexMode ?? 'standard', + indexMode: (indexMode ?? 'standard') as IndexMode, }; } diff --git a/x-pack/test/api_integration/apis/management/index_management/data_streams.ts b/x-pack/test/api_integration/apis/management/index_management/data_streams.ts index 791e23149aff1..2976d4eac03b4 100644 --- a/x-pack/test/api_integration/apis/management/index_management/data_streams.ts +++ b/x-pack/test/api_integration/apis/management/index_management/data_streams.ts @@ -73,6 +73,7 @@ export default function ({ getService }: FtrProviderContext) { health: 'yellow', indexTemplateName: testDataStreamName, hidden: false, + indexMode: 'standard', }); }); @@ -120,6 +121,7 @@ export default function ({ getService }: FtrProviderContext) { lifecycle: { enabled: true, }, + indexMode: 'standard', }); }); @@ -158,8 +160,25 @@ export default function ({ getService }: FtrProviderContext) { lifecycle: { enabled: true, }, + indexMode: 'standard', }); }); + + it('correctly returns index mode property', async () => { + const logsdbDataStreamName = 'logsdb-test-data-stream'; + const indexMode = 'logsdb'; + + await createDataStream(logsdbDataStreamName, indexMode); + + const { body: dataStream } = await supertest + .get(`${API_BASE_PATH}/data_streams/${logsdbDataStreamName}`) + .set('kbn-xsrf', 'xxx') + .expect(200); + + expect(dataStream.indexMode).to.eql(indexMode); + + await deleteDataStream(logsdbDataStreamName); + }); }); describe('Update', () => { diff --git a/x-pack/test/api_integration/apis/management/index_management/lib/datastreams.helpers.ts b/x-pack/test/api_integration/apis/management/index_management/lib/datastreams.helpers.ts index 65e2d733dd696..944c679c3205f 100644 --- a/x-pack/test/api_integration/apis/management/index_management/lib/datastreams.helpers.ts +++ b/x-pack/test/api_integration/apis/management/index_management/lib/datastreams.helpers.ts @@ -11,7 +11,7 @@ import { FtrProviderContext } from '../../../../ftr_provider_context'; export function datastreamsHelpers(getService: FtrProviderContext['getService']) { const es = getService('es'); - const createDataStream = async (name: string) => { + const createDataStream = async (name: string, indexMode?: string) => { // A data stream requires an index template before it can be created. await es.indices.putIndexTemplate({ name, @@ -26,6 +26,11 @@ export function datastreamsHelpers(getService: FtrProviderContext['getService']) }, }, }, + settings: { + index: { + mode: indexMode, + }, + }, lifecycle: { // @ts-expect-error @elastic/elasticsearch enabled prop is not typed yet enabled: true, From ce38555cd56c6aebd7705aab177077fa3293b4f4 Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Mon, 28 Oct 2024 10:55:00 +0000 Subject: [PATCH 03/14] Add index mode to index template details summary --- .../components/template_form/steps/step_review.tsx | 2 +- .../template_details/tabs/tab_summary.tsx | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx b/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx index 51f3933c8e27a..542ec4bcef75e 100644 --- a/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx +++ b/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx @@ -268,7 +268,7 @@ export const StepReview: React.FunctionComponent = React.memo( {getDescriptionText(serializedSettings)} - {/* Index settings */} + {/* Index mode */} = ({ templateDetails }) _meta, _kbnMeta: { isLegacy, hasDatastream }, allowAutoCreate, + template: { + settings: { index: indexSettings }, + }, } = templateDetails; const numIndexPatterns = indexPatterns.length; @@ -221,6 +224,17 @@ export const TabSummary: React.FunctionComponent = ({ templateDetails }) )} + {/* Index mode */} + + + + + {indexSettings?.mode ?? 'standard'} + + {/* Allow auto create */} {isLegacy !== true && allowAutoCreate !== allowAutoCreateRadioIds.NO_OVERWRITE_RADIO_OPTION && ( From 6cbad6a13bfc8e9789b63faa6809562aac34a77b Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Mon, 28 Oct 2024 14:41:39 +0000 Subject: [PATCH 04/14] Add translated labels --- .../common/types/data_streams.ts | 2 +- .../template_form/steps/step_review.tsx | 5 +++- .../application/lib/index_mode_labels.ts | 29 +++++++++++++++++++ .../data_stream_detail_panel.tsx | 3 +- .../data_stream_list/data_stream_list.tsx | 2 -- .../data_stream_table/data_stream_table.tsx | 2 ++ .../template_details/tabs/tab_summary.tsx | 3 +- 7 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 x-pack/plugins/index_management/public/application/lib/index_mode_labels.ts diff --git a/x-pack/plugins/index_management/common/types/data_streams.ts b/x-pack/plugins/index_management/common/types/data_streams.ts index 00b8685496149..993d32f32bee1 100644 --- a/x-pack/plugins/index_management/common/types/data_streams.ts +++ b/x-pack/plugins/index_management/common/types/data_streams.ts @@ -74,7 +74,7 @@ export interface DataStream { retention_determined_by?: string; globalMaxRetention?: string; }; - indexMode: string; + indexMode: IndexMode; } export interface DataStreamIndex { diff --git a/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx b/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx index 542ec4bcef75e..9f069b2293b42 100644 --- a/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx +++ b/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx @@ -22,6 +22,7 @@ import { EuiCodeBlock, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; +import { getIndexModeLabel } from '../../../lib/index_mode_labels'; import { allowAutoCreateRadioIds } from '../../../../../common/constants'; import { serializers } from '../../../../shared_imports'; @@ -276,7 +277,9 @@ export const StepReview: React.FunctionComponent = React.memo( /> - {serializedSettings?.index?.mode ?? 'standard'} + {getIndexModeLabel( + serializedSettings?.['index.mode'] ?? serializedSettings?.index?.mode + )} {/* Mappings */} diff --git a/x-pack/plugins/index_management/public/application/lib/index_mode_labels.ts b/x-pack/plugins/index_management/public/application/lib/index_mode_labels.ts new file mode 100644 index 0000000000000..409659b8133c3 --- /dev/null +++ b/x-pack/plugins/index_management/public/application/lib/index_mode_labels.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; + +export const getIndexModeLabel = (mode?: string | null) => { + switch (mode) { + case 'standard': + case null: + case undefined: + return i18n.translate('xpack.idxMgmt.indexModeLabels.standardModeLabel', { + defaultMessage: 'Standard', + }); + case 'logsdb': + return i18n.translate('xpack.idxMgmt.indexModeLabels.logsdbModeLabel', { + defaultMessage: 'LogsDB', + }); + case 'time_series': + return i18n.translate('xpack.idxMgmt.indexModeLabels.tsdbModeLabel', { + defaultMessage: 'Time series', + }); + default: + return mode; + } +}; diff --git a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_detail_panel/data_stream_detail_panel.tsx b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_detail_panel/data_stream_detail_panel.tsx index dde9525bccdad..42f65f6ab64ac 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_detail_panel/data_stream_detail_panel.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_detail_panel/data_stream_detail_panel.tsx @@ -34,6 +34,7 @@ import { EuiSpacer, } from '@elastic/eui'; +import { getIndexModeLabel } from '../../../../lib/index_mode_labels'; import { DiscoverLink } from '../../../../lib/discover_link'; import { getLifecycleValue } from '../../../../lib/data_streams'; import { SectionLoading, reactRouterNavigate } from '../../../../../shared_imports'; @@ -354,7 +355,7 @@ export const DataStreamDetailPanel: React.FunctionComponent = ({ defaultMessage: 'The index mode setting of the index template that configured this data stream.', }), - content: indexMode ?? 'standard', + content: getIndexModeLabel(indexMode), dataTestSubj: 'indexModeDetail', }, { diff --git a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_list.tsx b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_list.tsx index ee13f774ee54d..e2b736305ef3c 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_list.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_list.tsx @@ -84,8 +84,6 @@ export const DataStreamList: React.FunctionComponent(SHOW_PROJECT_LEVEL_RETENTION, true); diff --git a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx index 3a80203818bf1..e91fd644f795c 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx @@ -36,6 +36,7 @@ import { humanizeTimeStamp } from '../humanize_time_stamp'; import { DataStreamsBadges } from '../data_stream_badges'; import { ConditionalWrap } from '../data_stream_detail_panel'; import { isDataStreamFullyManagedByILM } from '../../../../lib/data_streams'; +import { getIndexModeLabel } from '../../../../lib/index_mode_labels'; import { FilterListButton, Filters } from '../../components'; import { type DataStreamFilterName } from '../data_stream_list'; @@ -191,6 +192,7 @@ export const DataStreamTable: React.FunctionComponent = ({ }), truncateText: true, sortable: true, + render: (indexMode: DataStream['indexMode']) => getIndexModeLabel(indexMode), }); columns.push({ diff --git a/x-pack/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx b/x-pack/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx index e1d62fae9aa9a..37beeea876b88 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx @@ -28,6 +28,7 @@ import { TemplateDeserialized } from '../../../../../../../common'; import { ILM_PAGES_POLICY_EDIT } from '../../../../../constants'; import { useIlmLocator } from '../../../../../services/use_ilm_locator'; import { allowAutoCreateRadioIds } from '../../../../../../../common/constants'; +import { getIndexModeLabel } from '../../../../../lib/index_mode_labels'; interface Props { templateDetails: TemplateDeserialized; @@ -232,7 +233,7 @@ export const TabSummary: React.FunctionComponent = ({ templateDetails }) /> - {indexSettings?.mode ?? 'standard'} + {getIndexModeLabel(indexSettings?.mode)} {/* Allow auto create */} From adab4e31e2eac698660cd37271df198d2d7ef821 Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Mon, 28 Oct 2024 15:52:21 +0000 Subject: [PATCH 05/14] Add functional tests --- .../components/template_form/steps/step_review.tsx | 4 ++-- .../data_streams_tab/data_streams_tab.ts | 10 ++++++++++ .../apps/index_management/index_template_wizard.ts | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx b/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx index 9f069b2293b42..9cb5c481b6b50 100644 --- a/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx +++ b/x-pack/plugins/index_management/public/application/components/template_form/steps/step_review.tsx @@ -270,13 +270,13 @@ export const StepReview: React.FunctionComponent = React.memo( {/* Index mode */} - + - + {getIndexModeLabel( serializedSettings?.['index.mode'] ?? serializedSettings?.index?.mode )} diff --git a/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts b/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts index d680778adc523..ce1a6f0bf934e 100644 --- a/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts +++ b/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts @@ -88,6 +88,16 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.click('closeDetailsButton'); }); + it('shows the correct index mode in the details flyout', async () => { + // Open details flyout + await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); + // Check that index mode detail exists and its label is "Standard" + expect(await testSubjects.exists('indexModeDetail')).to.be(true); + expect(await testSubjects.getVisibleText('indexModeDetail')).to.be('Standard'); + // Close flyout + await testSubjects.click('closeDetailsButton'); + }); + it('allows to update data retention', async () => { // Open details flyout await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); diff --git a/x-pack/test/functional/apps/index_management/index_template_wizard.ts b/x-pack/test/functional/apps/index_management/index_template_wizard.ts index 5b49286f6182b..cf6f1bf6a44a1 100644 --- a/x-pack/test/functional/apps/index_management/index_template_wizard.ts +++ b/x-pack/test/functional/apps/index_management/index_template_wizard.ts @@ -98,6 +98,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const summaryTabContent = await testSubjects.exists('summaryTabContent'); expect(summaryTabContent).to.be(true); + // Verify that index mode is set to "Standard" + expect(await testSubjects.exists('indexModeTitle')).to.be(true); + expect(await testSubjects.getVisibleText('indexModeValue')).to.be('Standard'); + // Click Create template await pageObjects.indexManagement.clickNextButton(); }); From c47c4736104ba6d8c4bef615a2723efc9d347ae5 Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Mon, 28 Oct 2024 15:59:23 +0000 Subject: [PATCH 06/14] Small fix --- .../routes/api/data_streams/register_get_route.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts index 9470958bed3b3..aeb1bbd8f2d74 100644 --- a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts @@ -73,9 +73,14 @@ const enhanceDataStreams = ({ } } - const indexTemplate = indexTemplates.find((template) => template.name === dataStream.template); - if (indexTemplate) { - enhancedDataStream.index_mode = indexTemplate.index_template?.template?.settings?.index?.mode; + if (indexTemplates) { + const indexTemplate = indexTemplates.find( + (template) => template.name === dataStream.template + ); + if (indexTemplate) { + enhancedDataStream.index_mode = + indexTemplate.index_template?.template?.settings?.index?.mode; + } } return enhancedDataStream; From e55abf410032e8bf403eee22bf8a5afeb3baee30 Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Mon, 28 Oct 2024 19:05:48 +0000 Subject: [PATCH 07/14] Update copy of tooltip --- .../data_stream_detail_panel/data_stream_detail_panel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_detail_panel/data_stream_detail_panel.tsx b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_detail_panel/data_stream_detail_panel.tsx index 42f65f6ab64ac..5b3bf0920c3b7 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_detail_panel/data_stream_detail_panel.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/data_stream_list/data_stream_detail_panel/data_stream_detail_panel.tsx @@ -353,7 +353,7 @@ export const DataStreamDetailPanel: React.FunctionComponent = ({ }), toolTip: i18n.translate('xpack.idxMgmt.dataStreamDetailPanel.indexModeToolTip', { defaultMessage: - 'The index mode setting of the index template that configured this data stream.', + "The index mode applied to the data stream's backing indices, as defined in its associated index template.", }), content: getIndexModeLabel(indexMode), dataTestSubj: 'indexModeDetail', From 249c9d3ba63b6dc5c7a5901b99781d03d48fbcfd Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 28 Oct 2024 19:20:58 +0000 Subject: [PATCH 08/14] [CI] Auto-commit changed files from 'node scripts/yarn_deduplicate' --- x-pack/plugins/index_management/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/index_management/tsconfig.json b/x-pack/plugins/index_management/tsconfig.json index eac67aa620973..d21aa58b43abb 100644 --- a/x-pack/plugins/index_management/tsconfig.json +++ b/x-pack/plugins/index_management/tsconfig.json @@ -55,6 +55,7 @@ "@kbn/ml-error-utils", "@kbn/unsaved-changes-prompt", "@kbn/shared-ux-table-persist", + "@kbn/index-management-plugin", ], "exclude": ["target/**/*"] } From 0bbec28af06c58665dba1499ae3de39106382950 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 28 Oct 2024 19:44:37 +0000 Subject: [PATCH 09/14] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- .../index_management/server/lib/data_stream_serialization.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts b/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts index 2c5a5019f1730..31c0baa6c6b8c 100644 --- a/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts +++ b/x-pack/plugins/index_management/server/lib/data_stream_serialization.ts @@ -6,8 +6,8 @@ */ import { ByteSizeValue } from '@kbn/config-schema'; +import { IndexMode } from '../../common/types/data_streams'; import type { DataStream, EnhancedDataStreamFromEs, Health } from '../../common'; -import { IndexMode } from "@kbn/index-management-plugin/common/types/data_streams"; export function deserializeDataStream(dataStreamFromEs: EnhancedDataStreamFromEs): DataStream { const { From 19e0e1d1c9c0d81691bb2484e687b1d54d380d13 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 28 Oct 2024 19:55:31 +0000 Subject: [PATCH 10/14] [CI] Auto-commit changed files from 'node scripts/yarn_deduplicate' --- x-pack/plugins/index_management/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugins/index_management/tsconfig.json b/x-pack/plugins/index_management/tsconfig.json index d21aa58b43abb..eac67aa620973 100644 --- a/x-pack/plugins/index_management/tsconfig.json +++ b/x-pack/plugins/index_management/tsconfig.json @@ -55,7 +55,6 @@ "@kbn/ml-error-utils", "@kbn/unsaved-changes-prompt", "@kbn/shared-ux-table-persist", - "@kbn/index-management-plugin", ], "exclude": ["target/**/*"] } From c0591690fc0a6ab962258c1757fcbf74c061ce60 Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Tue, 29 Oct 2024 10:18:07 +0000 Subject: [PATCH 11/14] Fix failing jest tests --- .../home/data_streams_tab.test.ts | 62 ++++++++++++++----- .../template_details/tabs/tab_summary.tsx | 6 +- 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.test.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.test.ts index a4ea7b9296e28..1d7ee65790cfd 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.test.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.test.ts @@ -205,8 +205,8 @@ describe('Data Streams tab', () => { const { tableCellsValues } = table.getMetaData('dataStreamTable'); expect(tableCellsValues).toEqual([ - ['', 'dataStream1', 'green', '1', '7 days', 'Delete'], - ['', 'dataStream2', 'green', '1', '5 days ', 'Delete'], + ['', 'dataStream1', 'green', '1', 'Standard', '7 days', 'Delete'], + ['', 'dataStream2', 'green', '1', 'Standard', '5 days ', 'Delete'], ]); }); @@ -254,6 +254,7 @@ describe('Data Streams tab', () => { 'December 31st, 1969 7:00:00 PM', '5b', '1', + 'Standard', '7 days', 'Delete', ], @@ -264,6 +265,7 @@ describe('Data Streams tab', () => { 'December 31st, 1969 7:00:00 PM', '1kb', '1', + 'Standard', '5 days ', 'Delete', ], @@ -289,6 +291,7 @@ describe('Data Streams tab', () => { 'December 31st, 1969 7:00:00 PM', '5b', '1', + 'Standard', '7 days', 'Delete', ], @@ -299,6 +302,7 @@ describe('Data Streams tab', () => { 'December 31st, 1969 7:00:00 PM', '1kb', '1', + 'Standard', '5 days ', 'Delete', ], @@ -346,8 +350,8 @@ describe('Data Streams tab', () => { const { tableCellsValues } = table.getMetaData('dataStreamTable'); expect(tableCellsValues).toEqual([ - ['', 'dataStream1', 'green', '156kb', '10000', '1', '7 days', 'Delete'], - ['', 'dataStream2', 'green', '156kb', '10000', '1', '5 days ', 'Delete'], + ['', 'dataStream1', 'green', '156kb', '10000', '1', 'Standard', '7 days', 'Delete'], + ['', 'dataStream2', 'green', '156kb', '10000', '1', 'Standard', '5 days ', 'Delete'], ]); }); @@ -378,6 +382,7 @@ describe('Data Streams tab', () => { 'December 31st, 1969 7:00:00 PM', '5b', '1', + 'Standard', '7 days', 'Delete', ], @@ -388,6 +393,7 @@ describe('Data Streams tab', () => { 'December 31st, 1969 7:00:00 PM', '1kb', '1', + 'Standard', '5 days ', 'Delete', ], @@ -509,8 +515,8 @@ describe('Data Streams tab', () => { const { tableCellsValues } = table.getMetaData('dataStreamTable'); expect(tableCellsValues).toEqual([ - ['', 'dataStream1', 'green', '1', 'Disabled', 'Delete'], - ['', 'dataStream2', 'green', '1', '', 'Delete'], + ['', 'dataStream1', 'green', '1', 'Standard', 'Disabled', 'Delete'], + ['', 'dataStream2', 'green', '1', 'Standard', '', 'Delete'], ]); await actions.clickNameAt(0); @@ -892,8 +898,16 @@ describe('Data Streams tab', () => { const { tableCellsValues } = table.getMetaData('dataStreamTable'); expect(tableCellsValues).toEqual([ - ['', `managed-data-stream${nonBreakingSpace}Managed`, 'green', '1', '7 days', 'Delete'], - ['', 'non-managed-data-stream', 'green', '1', '7 days', 'Delete'], + [ + '', + `managed-data-stream${nonBreakingSpace}Managed`, + 'green', + '1', + 'Standard', + '7 days', + 'Delete', + ], + ['', 'non-managed-data-stream', 'green', '1', 'Standard', '7 days', 'Delete'], ]); }); @@ -902,15 +916,23 @@ describe('Data Streams tab', () => { let { tableCellsValues } = table.getMetaData('dataStreamTable'); expect(tableCellsValues).toEqual([ - ['', `managed-data-stream${nonBreakingSpace}Managed`, 'green', '1', '7 days', 'Delete'], - ['', 'non-managed-data-stream', 'green', '1', '7 days', 'Delete'], + [ + '', + `managed-data-stream${nonBreakingSpace}Managed`, + 'green', + '1', + 'Standard', + '7 days', + 'Delete', + ], + ['', 'non-managed-data-stream', 'green', '1', 'Standard', '7 days', 'Delete'], ]); actions.toggleViewFilterAt(0); ({ tableCellsValues } = table.getMetaData('dataStreamTable')); expect(tableCellsValues).toEqual([ - ['', 'non-managed-data-stream', 'green', '1', '7 days', 'Delete'], + ['', 'non-managed-data-stream', 'green', '1', 'Standard', '7 days', 'Delete'], ]); }); }); @@ -942,7 +964,15 @@ describe('Data Streams tab', () => { const { tableCellsValues } = table.getMetaData('dataStreamTable'); expect(tableCellsValues).toEqual([ - ['', `hidden-data-stream${nonBreakingSpace}Hidden`, 'green', '1', '7 days', 'Delete'], + [ + '', + `hidden-data-stream${nonBreakingSpace}Hidden`, + 'green', + '1', + 'Standard', + '7 days', + 'Delete', + ], ]); }); }); @@ -989,10 +1019,10 @@ describe('Data Streams tab', () => { const { tableCellsValues } = table.getMetaData('dataStreamTable'); expect(tableCellsValues).toEqual([ - ['', 'dataStreamNoDelete', 'green', '1', '7 days', ''], - ['', 'dataStreamNoEditRetention', 'green', '1', '7 days', 'Delete'], - ['', 'dataStreamNoPermissions', 'green', '1', '7 days', ''], - ['', 'dataStreamWithDelete', 'green', '1', '7 days', 'Delete'], + ['', 'dataStreamNoDelete', 'green', '1', 'Standard', '7 days', ''], + ['', 'dataStreamNoEditRetention', 'green', '1', 'Standard', '7 days', 'Delete'], + ['', 'dataStreamNoPermissions', 'green', '1', 'Standard', '7 days', ''], + ['', 'dataStreamWithDelete', 'green', '1', 'Standard', '7 days', 'Delete'], ]); }); diff --git a/x-pack/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx b/x-pack/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx index 37beeea876b88..ff06a08014f61 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx @@ -58,9 +58,7 @@ export const TabSummary: React.FunctionComponent = ({ templateDetails }) _meta, _kbnMeta: { isLegacy, hasDatastream }, allowAutoCreate, - template: { - settings: { index: indexSettings }, - }, + template, } = templateDetails; const numIndexPatterns = indexPatterns.length; @@ -233,7 +231,7 @@ export const TabSummary: React.FunctionComponent = ({ templateDetails }) /> - {getIndexModeLabel(indexSettings?.mode)} + {getIndexModeLabel(template?.settings?.index?.mode)} {/* Allow auto create */} From 8eef79b7f209da78cd0b7be3cbbf6998fc6cbbd6 Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Tue, 29 Oct 2024 11:23:15 +0000 Subject: [PATCH 12/14] Resolve type check errors --- .../home/data_streams_tab.helpers.ts | 1 + .../common/lib/template_serialization.ts | 4 ++- .../index_management/common/types/indices.ts | 33 ++----------------- .../index_table/index_table_pagination.tsx | 4 +-- .../api/data_streams/register_get_route.ts | 5 +-- 5 files changed, 12 insertions(+), 35 deletions(-) diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts index bd119a77378af..608d2ce5390da 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts @@ -298,6 +298,7 @@ export const createDataStreamPayload = (dataStream: Partial): DataSt enabled: true, data_retention: '7d', }, + indexMode: 'standard', ...dataStream, }); diff --git a/x-pack/plugins/index_management/common/lib/template_serialization.ts b/x-pack/plugins/index_management/common/lib/template_serialization.ts index f8b4ed47a22f7..0ed52e3f04ba0 100644 --- a/x-pack/plugins/index_management/common/lib/template_serialization.ts +++ b/x-pack/plugins/index_management/common/lib/template_serialization.ts @@ -73,6 +73,8 @@ export function deserializeTemplate( type = 'managed'; } + const ilmPolicyName = settings?.index?.lifecycle?.name; + const deserializedTemplate: TemplateDeserialized = { name, version, @@ -80,7 +82,7 @@ export function deserializeTemplate( ...(template.lifecycle ? { lifecycle: deserializeESLifecycle(template.lifecycle) } : {}), indexPatterns: indexPatterns.sort(), template, - ilmPolicy: settings?.index?.lifecycle, + ilmPolicy: ilmPolicyName ? { name: ilmPolicyName } : undefined, composedOf: composedOf ?? [], ignoreMissingComponentTemplates: ignoreMissingComponentTemplates ?? [], dataStream, diff --git a/x-pack/plugins/index_management/common/types/indices.ts b/x-pack/plugins/index_management/common/types/indices.ts index 612aaf3bd6c9b..804a1bce1e299 100644 --- a/x-pack/plugins/index_management/common/types/indices.ts +++ b/x-pack/plugins/index_management/common/types/indices.ts @@ -5,29 +5,9 @@ * 2.0. */ -export type { Index } from '@kbn/index-management-shared-types'; +import { IndicesIndexSettingsKeys } from '@elastic/elasticsearch/lib/api/types'; -export interface IndexModule { - number_of_shards: number | string; - codec: string; - routing_partition_size: number; - refresh_interval: string; - load_fixed_bitset_filters_eagerly: boolean; - shard: { - check_on_startup: boolean | 'checksum'; - }; - number_of_replicas: number; - auto_expand_replicas: false | string; - lifecycle: LifecycleModule; - routing: { - allocation: { - enable: 'all' | 'primaries' | 'new_primaries' | 'none'; - }; - rebalance: { - enable: 'all' | 'primaries' | 'replicas' | 'none'; - }; - }; -} +export type { Index } from '@kbn/index-management-shared-types'; interface AnalysisModule { analyzer: { @@ -41,15 +21,8 @@ interface AnalysisModule { }; } -interface LifecycleModule { - name: string; - rollover_alias?: string; - parse_origination_date?: boolean; - origination_date?: number; -} - export interface IndexSettings { - index?: Partial; + index?: IndicesIndexSettingsKeys; analysis?: AnalysisModule; [key: string]: any; } diff --git a/x-pack/plugins/index_management/public/application/sections/home/index_list/index_table/index_table_pagination.tsx b/x-pack/plugins/index_management/public/application/sections/home/index_list/index_table/index_table_pagination.tsx index b9dd98e21a426..a0988aec797f6 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/index_list/index_table/index_table_pagination.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/index_list/index_table/index_table_pagination.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiTablePagination } from '@elastic/eui'; import { useEuiTablePersist } from '@kbn/shared-ux-table-persist'; -import { IndexModule } from '../../../../../../common'; +import { Index } from '../../../../../../common'; interface IndexTablePaginationProps { pager: any; @@ -27,7 +27,7 @@ export const IndexTablePagination = ({ readURLParams, setURLParam, }: IndexTablePaginationProps) => { - const { pageSize, onTableChange } = useEuiTablePersist({ + const { pageSize, onTableChange } = useEuiTablePersist({ tableId: 'indices', initialPageSize: pager.itemsPerPage, pageSizeOptions: PAGE_SIZE_OPTIONS, diff --git a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts index aeb1bbd8f2d74..cd47b8cc9e0bb 100644 --- a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts @@ -11,6 +11,7 @@ import { IScopedClusterClient } from '@kbn/core/server'; import { IndicesDataStream, IndicesDataStreamsStatsDataStreamsStatsItem, + IndicesGetIndexTemplateIndexTemplateItem, SecurityHasPrivilegesResponse, } from '@elastic/elasticsearch/lib/api/types'; import type { MeteringStats } from '../../../lib/types'; @@ -18,7 +19,7 @@ import { deserializeDataStream, deserializeDataStreamList, } from '../../../lib/data_stream_serialization'; -import { EnhancedDataStreamFromEs, TemplateSerialized } from '../../../../common/types'; +import { EnhancedDataStreamFromEs } from '../../../../common/types'; import { RouteDependencies } from '../../../types'; import { addBasePath } from '..'; @@ -38,7 +39,7 @@ const enhanceDataStreams = ({ meteringStats?: MeteringStats[]; dataStreamsPrivileges?: SecurityHasPrivilegesResponse; globalMaxRetention?: string; - indexTemplates?: Array<{ name: string; index_template: TemplateSerialized }>; + indexTemplates?: IndicesGetIndexTemplateIndexTemplateItem[]; }): EnhancedDataStreamFromEs[] => { return dataStreams.map((dataStream) => { const enhancedDataStream: EnhancedDataStreamFromEs = { From 5d6a396fb682a93588be97a1b917ab044739daae Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Tue, 29 Oct 2024 11:34:30 +0000 Subject: [PATCH 13/14] Fix functional tests --- .../reporting_and_security/datastream.ts | 1 + .../test_suites/common/index_management/datastreams.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/datastream.ts b/x-pack/test/reporting_api_integration/reporting_and_security/datastream.ts index f116110db78f1..0f2bbeb314dfa 100644 --- a/x-pack/test/reporting_api_integration/reporting_and_security/datastream.ts +++ b/x-pack/test/reporting_api_integration/reporting_and_security/datastream.ts @@ -61,6 +61,7 @@ export default function ({ getService }: FtrProviderContext) { nextGenerationManagedBy: 'Index Lifecycle Management', storageSize: expect.any(String), storageSizeBytes: expect.any(Number), + indexMode: 'standard', }); }); }); diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts b/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts index de3a92587d6b9..949a1c7e6146e 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts +++ b/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts @@ -80,6 +80,7 @@ export default function ({ getService }: FtrProviderContext) { health: 'green', indexTemplateName: testDataStreamName, hidden: false, + indexMode: 'standard', }); }); From 2590ba48f300a2686804ef60e4b25436658d2bfb Mon Sep 17 00:00:00 2001 From: Elena Stoeva Date: Wed, 30 Oct 2024 11:43:29 +0000 Subject: [PATCH 14/14] Fix failing test and type error, add suggested test --- .../hooks/use_get_data_stream_statuses.ts | 1 + .../data_streams_tab/data_streams_tab.ts | 47 +++++++++++++++---- .../common/index_management/datastreams.ts | 1 + 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/use_get_data_stream_statuses.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/use_get_data_stream_statuses.ts index f3b3136200bd7..00d301e9eb706 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/use_get_data_stream_statuses.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/use_get_data_stream_statuses.ts @@ -94,6 +94,7 @@ function toMissingDataStream({ privileges: { delete_index: true, manage_data_stream_lifecycle: true }, hidden: false, nextGenerationManagedBy: 'Data stream lifecycle', + indexMode: 'standard', }; } diff --git a/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts b/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts index ce1a6f0bf934e..97ceeefbee9bd 100644 --- a/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts +++ b/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts @@ -88,14 +88,45 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.click('closeDetailsButton'); }); - it('shows the correct index mode in the details flyout', async () => { - // Open details flyout - await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); - // Check that index mode detail exists and its label is "Standard" - expect(await testSubjects.exists('indexModeDetail')).to.be(true); - expect(await testSubjects.getVisibleText('indexModeDetail')).to.be('Standard'); - // Close flyout - await testSubjects.click('closeDetailsButton'); + describe('shows the correct index mode in the details flyout', function () { + it('standard index mode', async () => { + // Open details flyout of existing data stream - it has standard index mode + await pageObjects.indexManagement.clickDataStreamNameLink(TEST_DS_NAME); + // Check that index mode detail exists and its label is "Standard" + expect(await testSubjects.exists('indexModeDetail')).to.be(true); + expect(await testSubjects.getVisibleText('indexModeDetail')).to.be('Standard'); + // Close flyout + await testSubjects.click('closeDetailsButton'); + }); + + it('logsdb index mode', async () => { + // Create an index template with a logsdb index mode + await es.indices.putIndexTemplate({ + name: `logsdb_index_template`, + index_patterns: ['test-logsdb'], + data_stream: {}, + template: { + settings: { mode: 'logsdb' }, + }, + }); + // Create a data stream matching the index pattern of the index template above + await es.indices.createDataStream({ + name: 'test-logsdb', + }); + await browser.refresh(); + // Open details flyout of data stream + await pageObjects.indexManagement.clickDataStreamNameLink('test-logsdb'); + // Check that index mode detail exists and its label is "LogsDB" + expect(await testSubjects.exists('indexModeDetail')).to.be(true); + expect(await testSubjects.getVisibleText('indexModeDetail')).to.be('LogsDB'); + // Close flyout + await testSubjects.click('closeDetailsButton'); + // Delete data stream and index template + await es.indices.deleteDataStream({ name: 'test-logsdb' }); + await es.indices.deleteIndexTemplate({ + name: `logsdb_index_template`, + }); + }); }); it('allows to update data retention', async () => { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts b/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts index 949a1c7e6146e..12151f1b169db 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts +++ b/x-pack/test_serverless/api_integration/test_suites/common/index_management/datastreams.ts @@ -122,6 +122,7 @@ export default function ({ getService }: FtrProviderContext) { meteringDocsCount: 0, meteringStorageSize: '0b', meteringStorageSizeBytes: 0, + indexMode: 'standard', }); }); });