From 4c261fe2eeed222d8ca58ceb69559aaca119a299 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 24 Jan 2025 19:00:31 +0400 Subject: [PATCH] Support synthetic_source_keep and mapping.source.mode (#3596) * Support synthetic_source_keep and mapping.source.mode * Skip intermediate class * Revert "Skip intermediate class" This reverts commit 3b71a0db0dc4c31df3bd473d36fed69f0e91ca1d. (cherry picked from commit aecc157b6c01a4b766728dff030232a53b23f00d) --- output/openapi/elasticsearch-openapi.json | 42 +++++- .../elasticsearch-serverless-openapi.json | 42 +++++- output/schema/schema-serverless.json | 140 +++++++++++++++--- output/schema/schema.json | 140 +++++++++++++++--- output/typescript/types.ts | 12 +- specification/_types/mapping/Property.ts | 21 +++ specification/indices/_types/IndexSettings.ts | 13 +- 7 files changed, 362 insertions(+), 48 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index f51b79810e..40c2e9b136 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -61753,8 +61753,18 @@ "dimension_fields": { "$ref": "#/components/schemas/indices._types:MappingLimitSettingsDimensionFields" }, + "source": { + "$ref": "#/components/schemas/indices._types:MappingLimitSettingsSourceFields" + }, "ignore_malformed": { - "type": "boolean" + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "string" + } + ] } } }, @@ -61830,6 +61840,25 @@ } } }, + "indices._types:MappingLimitSettingsSourceFields": { + "type": "object", + "properties": { + "mode": { + "$ref": "#/components/schemas/indices._types:SourceMode" + } + }, + "required": [ + "mode" + ] + }, + "indices._types:SourceMode": { + "type": "string", + "enum": [ + "disabled", + "stored", + "synthetic" + ] + }, "indices._types:IndexingSlowlogSettings": { "type": "object", "properties": { @@ -63170,9 +63199,20 @@ "additionalProperties": { "$ref": "#/components/schemas/_types.mapping:Property" } + }, + "synthetic_source_keep": { + "$ref": "#/components/schemas/_types.mapping:SyntheticSourceKeepEnum" } } }, + "_types.mapping:SyntheticSourceKeepEnum": { + "type": "string", + "enum": [ + "none", + "arrays", + "all" + ] + }, "_types.mapping:BooleanProperty": { "allOf": [ { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index e126b747a8..b620e5b1ac 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -40529,8 +40529,18 @@ "dimension_fields": { "$ref": "#/components/schemas/indices._types:MappingLimitSettingsDimensionFields" }, + "source": { + "$ref": "#/components/schemas/indices._types:MappingLimitSettingsSourceFields" + }, "ignore_malformed": { - "type": "boolean" + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "string" + } + ] } } }, @@ -40606,6 +40616,25 @@ } } }, + "indices._types:MappingLimitSettingsSourceFields": { + "type": "object", + "properties": { + "mode": { + "$ref": "#/components/schemas/indices._types:SourceMode" + } + }, + "required": [ + "mode" + ] + }, + "indices._types:SourceMode": { + "type": "string", + "enum": [ + "disabled", + "stored", + "synthetic" + ] + }, "indices._types:IndexingSlowlogSettings": { "type": "object", "properties": { @@ -41153,9 +41182,20 @@ "additionalProperties": { "$ref": "#/components/schemas/_types.mapping:Property" } + }, + "synthetic_source_keep": { + "$ref": "#/components/schemas/_types.mapping:SyntheticSourceKeepEnum" } } }, + "_types.mapping:SyntheticSourceKeepEnum": { + "type": "string", + "enum": [ + "none", + "arrays", + "all" + ] + }, "_types.mapping:BooleanProperty": { "allOf": [ { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index d4aac5966f..06feb27bac 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -53848,7 +53848,7 @@ "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L170-L219" + "specLocation": "_types/mapping/Property.ts#L191-L240" }, { "kind": "enum", @@ -87588,7 +87588,7 @@ "name": "Property", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L98-L168", + "specLocation": "_types/mapping/Property.ts#L119-L189", "type": { "items": [ { @@ -88144,9 +88144,42 @@ } } } + }, + { + "name": "synthetic_source_keep", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SyntheticSourceKeepEnum", + "namespace": "_types.mapping" + } + } + } + ], + "specLocation": "_types/mapping/Property.ts#L86-L97" + }, + { + "kind": "enum", + "members": [ + { + "description": "Synthetic source diverges from the original source (default)", + "name": "none" + }, + { + "description": "Arrays of the corresponding field or object preserve the original element ordering and duplicate elements.\nThe synthetic source fragment for such arrays is not guaranteed to match the original source exactly,\ne.g. array [1, 2, [5], [[4, [3]]], 5] may appear as-is or in an equivalent format like [1, 2, 5, 4, 3, 5].\nThe exact format may change in the future, in an effort to reduce the storage overhead of this option.", + "name": "arrays" + }, + { + "description": "The source for both singleton instances and arrays of the corresponding field or object gets recorded.\nWhen applied to objects, the source of all sub-objects and sub-fields gets captured.\nFurthermore, the original source of arrays gets captured and appears in synthetic source with no modifications.", + "name": "all" } ], - "specLocation": "_types/mapping/Property.ts#L86-L96" + "name": { + "name": "SyntheticSourceKeepEnum", + "namespace": "_types.mapping" + }, + "specLocation": "_types/mapping/Property.ts#L99-L117" }, { "inherits": { @@ -95597,6 +95630,25 @@ ], "specLocation": "indices/_types/IndexSettings.ts#L224-L228" }, + { + "kind": "enum", + "members": [ + { + "name": "disabled" + }, + { + "name": "stored" + }, + { + "name": "synthetic" + } + ], + "name": { + "name": "SourceMode", + "namespace": "indices._types" + }, + "specLocation": "indices/_types/IndexSettings.ts#L501-L505" + }, { "isOpen": true, "kind": "enum", @@ -95622,7 +95674,7 @@ "name": "StorageType", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L526-L554" + "specLocation": "indices/_types/IndexSettings.ts#L537-L565" }, { "kind": "enum", @@ -114706,7 +114758,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L496-L501" + "specLocation": "indices/_types/IndexSettings.ts#L507-L512" }, { "kind": "interface", @@ -114738,7 +114790,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L503-L506" + "specLocation": "indices/_types/IndexSettings.ts#L514-L517" }, { "kind": "interface", @@ -114792,7 +114844,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L508-L513" + "specLocation": "indices/_types/IndexSettings.ts#L519-L524" }, { "kind": "interface", @@ -115730,18 +115782,41 @@ } }, { - "name": "ignore_malformed", + "name": "source", "required": false, "type": { "kind": "instance_of", "type": { - "name": "boolean", - "namespace": "_builtins" + "name": "MappingLimitSettingsSourceFields", + "namespace": "indices._types" } } + }, + { + "name": "ignore_malformed", + "required": false, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + }, + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + ], + "kind": "union_of" + } } ], - "specLocation": "indices/_types/IndexSettings.ts#L417-L430" + "specLocation": "indices/_types/IndexSettings.ts#L417-L431" }, { "kind": "interface", @@ -115801,7 +115876,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L432-L449" + "specLocation": "indices/_types/IndexSettings.ts#L433-L450" }, { "kind": "interface", @@ -115824,7 +115899,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L451-L458" + "specLocation": "indices/_types/IndexSettings.ts#L452-L459" }, { "kind": "interface", @@ -115847,7 +115922,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L460-L468" + "specLocation": "indices/_types/IndexSettings.ts#L461-L469" }, { "kind": "interface", @@ -115870,7 +115945,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L470-L477" + "specLocation": "indices/_types/IndexSettings.ts#L471-L478" }, { "kind": "interface", @@ -115892,7 +115967,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L479-L486" + "specLocation": "indices/_types/IndexSettings.ts#L480-L487" }, { "kind": "interface", @@ -115914,7 +115989,28 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L488-L494" + "specLocation": "indices/_types/IndexSettings.ts#L489-L495" + }, + { + "kind": "interface", + "name": { + "name": "MappingLimitSettingsSourceFields", + "namespace": "indices._types" + }, + "properties": [ + { + "name": "mode", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "SourceMode", + "namespace": "indices._types" + } + } + } + ], + "specLocation": "indices/_types/IndexSettings.ts#L497-L499" }, { "kind": "interface", @@ -115968,7 +116064,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L569-L574" + "specLocation": "indices/_types/IndexSettings.ts#L580-L585" }, { "kind": "interface", @@ -115992,7 +116088,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L576-L583" + "specLocation": "indices/_types/IndexSettings.ts#L587-L594" }, { "kind": "interface", @@ -116013,7 +116109,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L556-L558" + "specLocation": "indices/_types/IndexSettings.ts#L567-L569" }, { "kind": "interface", @@ -116035,7 +116131,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L560-L567" + "specLocation": "indices/_types/IndexSettings.ts#L571-L578" }, { "kind": "interface", @@ -116068,7 +116164,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L515-L524" + "specLocation": "indices/_types/IndexSettings.ts#L526-L535" }, { "kind": "interface", diff --git a/output/schema/schema.json b/output/schema/schema.json index 9408a93095..3f34f8e4d1 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -76559,7 +76559,7 @@ "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L170-L219" + "specLocation": "_types/mapping/Property.ts#L191-L240" }, { "kind": "interface", @@ -78280,7 +78280,7 @@ "name": "Property", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L98-L168", + "specLocation": "_types/mapping/Property.ts#L119-L189", "type": { "kind": "union_of", "items": [ @@ -78747,9 +78747,20 @@ } } } + }, + { + "name": "synthetic_source_keep", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SyntheticSourceKeepEnum", + "namespace": "_types.mapping" + } + } } ], - "specLocation": "_types/mapping/Property.ts#L86-L96" + "specLocation": "_types/mapping/Property.ts#L86-L97" }, { "kind": "interface", @@ -79660,6 +79671,28 @@ ], "specLocation": "_types/mapping/specialized.ts#L43-L48" }, + { + "kind": "enum", + "members": [ + { + "description": "Synthetic source diverges from the original source (default)", + "name": "none" + }, + { + "description": "Arrays of the corresponding field or object preserve the original element ordering and duplicate elements.\nThe synthetic source fragment for such arrays is not guaranteed to match the original source exactly,\ne.g. array [1, 2, [5], [[4, [3]]], 5] may appear as-is or in an equivalent format like [1, 2, 5, 4, 3, 5].\nThe exact format may change in the future, in an effort to reduce the storage overhead of this option.", + "name": "arrays" + }, + { + "description": "The source for both singleton instances and arrays of the corresponding field or object gets recorded.\nWhen applied to objects, the source of all sub-objects and sub-fields gets captured.\nFurthermore, the original source of arrays gets captured and appears in synthetic source with no modifications.", + "name": "all" + } + ], + "name": { + "name": "SyntheticSourceKeepEnum", + "namespace": "_types.mapping" + }, + "specLocation": "_types/mapping/Property.ts#L99-L117" + }, { "kind": "enum", "members": [ @@ -129556,7 +129589,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L556-L558" + "specLocation": "indices/_types/IndexSettings.ts#L567-L569" }, { "kind": "interface", @@ -129578,7 +129611,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L560-L567" + "specLocation": "indices/_types/IndexSettings.ts#L571-L578" }, { "kind": "interface", @@ -129632,7 +129665,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L569-L574" + "specLocation": "indices/_types/IndexSettings.ts#L580-L585" }, { "kind": "interface", @@ -129656,7 +129689,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L576-L583" + "specLocation": "indices/_types/IndexSettings.ts#L587-L594" }, { "kind": "enum", @@ -129768,18 +129801,41 @@ } }, { - "name": "ignore_malformed", + "name": "source", "required": false, "type": { "kind": "instance_of", "type": { - "name": "boolean", - "namespace": "_builtins" + "name": "MappingLimitSettingsSourceFields", + "namespace": "indices._types" } } + }, + { + "name": "ignore_malformed", + "required": false, + "type": { + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + }, + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + ] + } } ], - "specLocation": "indices/_types/IndexSettings.ts#L417-L430" + "specLocation": "indices/_types/IndexSettings.ts#L417-L431" }, { "kind": "interface", @@ -129802,7 +129858,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L451-L458" + "specLocation": "indices/_types/IndexSettings.ts#L452-L459" }, { "kind": "interface", @@ -129824,7 +129880,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L488-L494" + "specLocation": "indices/_types/IndexSettings.ts#L489-L495" }, { "kind": "interface", @@ -129846,7 +129902,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L479-L486" + "specLocation": "indices/_types/IndexSettings.ts#L480-L487" }, { "kind": "interface", @@ -129869,7 +129925,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L460-L468" + "specLocation": "indices/_types/IndexSettings.ts#L461-L469" }, { "kind": "interface", @@ -129892,7 +129948,28 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L470-L477" + "specLocation": "indices/_types/IndexSettings.ts#L471-L478" + }, + { + "kind": "interface", + "name": { + "name": "MappingLimitSettingsSourceFields", + "namespace": "indices._types" + }, + "properties": [ + { + "name": "mode", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "SourceMode", + "namespace": "indices._types" + } + } + } + ], + "specLocation": "indices/_types/IndexSettings.ts#L497-L499" }, { "kind": "interface", @@ -129952,7 +130029,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L432-L449" + "specLocation": "indices/_types/IndexSettings.ts#L433-L450" }, { "kind": "interface", @@ -130726,7 +130803,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L496-L501" + "specLocation": "indices/_types/IndexSettings.ts#L507-L512" }, { "kind": "interface", @@ -130780,7 +130857,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L508-L513" + "specLocation": "indices/_types/IndexSettings.ts#L519-L524" }, { "kind": "interface", @@ -130812,7 +130889,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L503-L506" + "specLocation": "indices/_types/IndexSettings.ts#L514-L517" }, { "kind": "interface", @@ -130849,6 +130926,25 @@ ], "specLocation": "indices/_types/IndexSettings.ts#L50-L63" }, + { + "kind": "enum", + "members": [ + { + "name": "disabled" + }, + { + "name": "stored" + }, + { + "name": "synthetic" + } + ], + "name": { + "name": "SourceMode", + "namespace": "indices._types" + }, + "specLocation": "indices/_types/IndexSettings.ts#L501-L505" + }, { "kind": "interface", "name": { @@ -130880,7 +130976,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L515-L524" + "specLocation": "indices/_types/IndexSettings.ts#L526-L535" }, { "kind": "enum", @@ -130907,7 +131003,7 @@ "name": "StorageType", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L526-L554" + "specLocation": "indices/_types/IndexSettings.ts#L537-L565" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 3a3c37d637..3868d9a64d 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5734,6 +5734,7 @@ export interface MappingPropertyBase { ignore_above?: integer dynamic?: MappingDynamicMapping fields?: Record + synthetic_source_keep?: MappingSyntheticSourceKeepEnum } export interface MappingRangePropertyBase extends MappingDocValuesPropertyBase { @@ -5840,6 +5841,8 @@ export interface MappingSuggestContext { precision?: integer | string } +export type MappingSyntheticSourceKeepEnum = 'none' | 'arrays' | 'all' + export type MappingTermVectorOption = 'no' | 'yes' | 'with_offsets' | 'with_positions' | 'with_positions_offsets' | 'with_positions_offsets_payloads' | 'with_positions_payloads' export interface MappingTextIndexPrefixes { @@ -11353,7 +11356,8 @@ export interface IndicesMappingLimitSettings { nested_objects?: IndicesMappingLimitSettingsNestedObjects field_name_length?: IndicesMappingLimitSettingsFieldNameLength dimension_fields?: IndicesMappingLimitSettingsDimensionFields - ignore_malformed?: boolean + source?: IndicesMappingLimitSettingsSourceFields + ignore_malformed?: boolean | string } export interface IndicesMappingLimitSettingsDepth { @@ -11376,6 +11380,10 @@ export interface IndicesMappingLimitSettingsNestedObjects { limit?: long } +export interface IndicesMappingLimitSettingsSourceFields { + mode: IndicesSourceMode +} + export interface IndicesMappingLimitSettingsTotalFields { limit?: long | string ignore_dynamic_beyond_limit?: boolean | string @@ -11503,6 +11511,8 @@ export interface IndicesSoftDeletes { retention_lease?: IndicesRetentionLease } +export type IndicesSourceMode = 'disabled' | 'stored' | 'synthetic' + export interface IndicesStorage { type: IndicesStorageType allow_mmap?: boolean diff --git a/specification/_types/mapping/Property.ts b/specification/_types/mapping/Property.ts index 078d2f573a..6c6911e93f 100644 --- a/specification/_types/mapping/Property.ts +++ b/specification/_types/mapping/Property.ts @@ -93,6 +93,27 @@ export class PropertyBase { ignore_above?: integer dynamic?: DynamicMapping fields?: Dictionary + synthetic_source_keep?: SyntheticSourceKeepEnum +} + +export enum SyntheticSourceKeepEnum { + /** + * Synthetic source diverges from the original source (default) + */ + none, + /** + * Arrays of the corresponding field or object preserve the original element ordering and duplicate elements. + * The synthetic source fragment for such arrays is not guaranteed to match the original source exactly, + * e.g. array [1, 2, [5], [[4, [3]]], 5] may appear as-is or in an equivalent format like [1, 2, 5, 4, 3, 5]. + * The exact format may change in the future, in an effort to reduce the storage overhead of this option. + */ + arrays, + /** + * The source for both singleton instances and arrays of the corresponding field or object gets recorded. + * When applied to objects, the source of all sub-objects and sub-fields gets captured. + * Furthermore, the original source of arrays gets captured and appears in synthetic source with no modifications. + */ + all } /** diff --git a/specification/indices/_types/IndexSettings.ts b/specification/indices/_types/IndexSettings.ts index 2c223b7700..038ea7617b 100644 --- a/specification/indices/_types/IndexSettings.ts +++ b/specification/indices/_types/IndexSettings.ts @@ -426,7 +426,8 @@ export class MappingLimitSettings { nested_objects?: MappingLimitSettingsNestedObjects field_name_length?: MappingLimitSettingsFieldNameLength dimension_fields?: MappingLimitSettingsDimensionFields - ignore_malformed?: boolean + source?: MappingLimitSettingsSourceFields + ignore_malformed?: boolean | string } export class MappingLimitSettingsTotalFields { @@ -493,6 +494,16 @@ export class MappingLimitSettingsDimensionFields { limit?: long } +export class MappingLimitSettingsSourceFields { + mode: SourceMode +} + +export enum SourceMode { + disabled, + stored, + synthetic +} + export class SlowlogSettings { level?: string source?: integer