diff --git a/x-pack/platform/plugins/shared/fleet/common/types/models/epm.ts b/x-pack/platform/plugins/shared/fleet/common/types/models/epm.ts index a7b5d59d990f4..b5f3d5d2cb54e 100644 --- a/x-pack/platform/plugins/shared/fleet/common/types/models/epm.ts +++ b/x-pack/platform/plugins/shared/fleet/common/types/models/epm.ts @@ -768,6 +768,13 @@ export interface IndexTemplate { composed_of: string[]; ignore_missing_component_templates?: string[]; _meta: object; + + // These properties are returned on ES read operations and + // not allowed to be set on ES write operations + created_date?: number; + created_date_millis?: number; + modified_date?: number; + modified_date_millis?: number; } export interface ESAssetMetadata { diff --git a/x-pack/platform/plugins/shared/fleet/server/services/package_policies/experimental_datastream_features.ts b/x-pack/platform/plugins/shared/fleet/server/services/package_policies/experimental_datastream_features.ts index 12326d47f0728..b144bc1fc0e8f 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/package_policies/experimental_datastream_features.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/package_policies/experimental_datastream_features.ts @@ -199,8 +199,17 @@ export async function handleExperimentalDatastreamFeatureOptIn({ }); } - const indexTemplate = indexTemplateRes.index_templates[0].index_template; - let updatedIndexTemplate = indexTemplate as IndexTemplate; + const rawIndexTemplate = indexTemplateRes.index_templates[0].index_template; + + // Remove system-managed properties (dates) that cannot be set during create/update of index templates + const { + created_date: createdDate, + created_date_millis: createdDateMillis, + modified_date: modifiedDate, + modified_date_millis: modifiedDateMillis, + ...indexTemplate + } = rawIndexTemplate as IndexTemplate; + let updatedIndexTemplate = indexTemplate; if (isTSDBOptInChanged) { const indexTemplateBody = { diff --git a/x-pack/platform/test/fleet_api_integration/apis/epm/data_stream.ts b/x-pack/platform/test/fleet_api_integration/apis/epm/data_stream.ts index 41928500d7a13..e71917ef8389a 100644 --- a/x-pack/platform/test/fleet_api_integration/apis/epm/data_stream.ts +++ b/x-pack/platform/test/fleet_api_integration/apis/epm/data_stream.ts @@ -192,8 +192,7 @@ export default function (providerContext: FtrProviderContext) { await installPackage(pkgName, pkgUpdateVersion); }); - // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/230902 - describe.skip('When enabling experimental data stream features', () => { + describe('When enabling experimental data stream features', () => { let agentPolicyId: string; let packagePolicyId: string;