From 9eff69a2a7b3f764a1e39ac50418ca184a68612f Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Tue, 27 Jun 2023 09:42:01 -0600 Subject: [PATCH] Allow nullable `lifecycle` and `data_retention` template values These keys allow using an explicit `null` as the value to "unset" the configuration when merging multiple component templates. As related to the merging tables seen in https://github.com/elastic/elasticsearch/pull/95979#issuecomment-1549717558 Relates also to the discussion in #2049 --- output/schema/schema.json | 44 ++++++++++++++----- output/typescript/types.ts | 4 +- specification/indices/_types/DataLifecycle.ts | 2 +- .../IndicesPutIndexTemplateRequest.ts | 2 +- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index ddfe02fe1c..9133429e39 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -106906,11 +106906,23 @@ "name": "data_retention", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "Duration", - "namespace": "_types" - } + "items": [ + { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ], + "kind": "union_of" } } ], @@ -116658,11 +116670,23 @@ "since": "8.8.0", "stability": "experimental", "type": { - "kind": "instance_of", - "type": { - "name": "DataLifecycle", - "namespace": "indices._types" - } + "items": [ + { + "kind": "instance_of", + "type": { + "name": "DataLifecycle", + "namespace": "indices._types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ], + "kind": "union_of" } } ], diff --git a/output/typescript/types.ts b/output/typescript/types.ts index d34c94413e..2b9fcacf39 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -9594,7 +9594,7 @@ export interface IndicesCacheQueries { } export interface IndicesDataLifecycle { - data_retention?: Duration + data_retention?: Duration | null } export interface IndicesDataLifecycleWithRollover { @@ -10644,7 +10644,7 @@ export interface IndicesPutIndexTemplateIndexTemplateMapping { aliases?: Record mappings?: MappingTypeMapping settings?: IndicesIndexSettings - lifecycle?: IndicesDataLifecycle + lifecycle?: IndicesDataLifecycle | null } export interface IndicesPutIndexTemplateRequest extends RequestBase { diff --git a/specification/indices/_types/DataLifecycle.ts b/specification/indices/_types/DataLifecycle.ts index 5b9997931e..4e703acbf1 100644 --- a/specification/indices/_types/DataLifecycle.ts +++ b/specification/indices/_types/DataLifecycle.ts @@ -25,7 +25,7 @@ import { ByteSize } from '@_types/common' * Data lifecycle denotes that a data stream is managed by DLM and contains the configuration. */ export class DataLifecycle { - data_retention?: Duration + data_retention?: Duration | null } /** diff --git a/specification/indices/put_index_template/IndicesPutIndexTemplateRequest.ts b/specification/indices/put_index_template/IndicesPutIndexTemplateRequest.ts index 411f076b90..06c8082d8b 100644 --- a/specification/indices/put_index_template/IndicesPutIndexTemplateRequest.ts +++ b/specification/indices/put_index_template/IndicesPutIndexTemplateRequest.ts @@ -66,5 +66,5 @@ export class IndexTemplateMapping { * @availability stack since=8.8.0 stability=experimental * @availability serverless stability=experimental */ - lifecycle?: DataLifecycle + lifecycle?: DataLifecycle | null }