From 984d9b679f47047a74c87dd406ccc4a17ab2cc31 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) # Conflicts: # output/schema/schema-serverless.json # output/schema/schema.json --- 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 342cfaed81..378e8951cb 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -62027,8 +62027,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" + } + ] } } }, @@ -62104,6 +62114,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": { @@ -62645,9 +62674,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 51e916ee1d..9234456714 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -40390,8 +40390,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" + } + ] } } }, @@ -40467,6 +40477,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": { @@ -41008,9 +41037,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 e48c84b729..9b04a28fb6 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -53516,7 +53516,7 @@ "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L166-L213" + "specLocation": "_types/mapping/Property.ts#L187-L234" }, { "kind": "enum", @@ -87110,7 +87110,7 @@ "name": "Property", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L96-L164", + "specLocation": "_types/mapping/Property.ts#L117-L185", "type": { "items": [ { @@ -87652,9 +87652,42 @@ } } } + }, + { + "name": "synthetic_source_keep", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SyntheticSourceKeepEnum", + "namespace": "_types.mapping" + } + } + } + ], + "specLocation": "_types/mapping/Property.ts#L84-L95" + }, + { + "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#L84-L94" + "name": { + "name": "SyntheticSourceKeepEnum", + "namespace": "_types.mapping" + }, + "specLocation": "_types/mapping/Property.ts#L97-L115" }, { "inherits": { @@ -95000,6 +95033,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", @@ -95025,7 +95077,7 @@ "name": "StorageType", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L526-L554" + "specLocation": "indices/_types/IndexSettings.ts#L537-L565" }, { "kind": "enum", @@ -113938,7 +113990,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L496-L501" + "specLocation": "indices/_types/IndexSettings.ts#L507-L512" }, { "kind": "interface", @@ -113970,7 +114022,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L503-L506" + "specLocation": "indices/_types/IndexSettings.ts#L514-L517" }, { "kind": "interface", @@ -114024,7 +114076,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L508-L513" + "specLocation": "indices/_types/IndexSettings.ts#L519-L524" }, { "kind": "interface", @@ -114962,18 +115014,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", @@ -115033,7 +115108,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L432-L449" + "specLocation": "indices/_types/IndexSettings.ts#L433-L450" }, { "kind": "interface", @@ -115056,7 +115131,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L451-L458" + "specLocation": "indices/_types/IndexSettings.ts#L452-L459" }, { "kind": "interface", @@ -115079,7 +115154,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L460-L468" + "specLocation": "indices/_types/IndexSettings.ts#L461-L469" }, { "kind": "interface", @@ -115102,7 +115177,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L470-L477" + "specLocation": "indices/_types/IndexSettings.ts#L471-L478" }, { "kind": "interface", @@ -115124,7 +115199,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L479-L486" + "specLocation": "indices/_types/IndexSettings.ts#L480-L487" }, { "kind": "interface", @@ -115146,7 +115221,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", @@ -115200,7 +115296,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L569-L574" + "specLocation": "indices/_types/IndexSettings.ts#L580-L585" }, { "kind": "interface", @@ -115224,7 +115320,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L576-L583" + "specLocation": "indices/_types/IndexSettings.ts#L587-L594" }, { "kind": "interface", @@ -115245,7 +115341,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L556-L558" + "specLocation": "indices/_types/IndexSettings.ts#L567-L569" }, { "kind": "interface", @@ -115267,7 +115363,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L560-L567" + "specLocation": "indices/_types/IndexSettings.ts#L571-L578" }, { "kind": "interface", @@ -115300,7 +115396,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 bc05d6c949..02948d1fb6 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -76141,7 +76141,7 @@ "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L166-L213" + "specLocation": "_types/mapping/Property.ts#L187-L234" }, { "kind": "interface", @@ -77805,7 +77805,7 @@ "name": "Property", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L96-L164", + "specLocation": "_types/mapping/Property.ts#L117-L185", "type": { "kind": "union_of", "items": [ @@ -78258,9 +78258,20 @@ } } } + }, + { + "name": "synthetic_source_keep", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SyntheticSourceKeepEnum", + "namespace": "_types.mapping" + } + } } ], - "specLocation": "_types/mapping/Property.ts#L84-L94" + "specLocation": "_types/mapping/Property.ts#L84-L95" }, { "kind": "interface", @@ -79171,6 +79182,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#L97-L115" + }, { "kind": "enum", "members": [ @@ -128627,7 +128660,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L556-L558" + "specLocation": "indices/_types/IndexSettings.ts#L567-L569" }, { "kind": "interface", @@ -128649,7 +128682,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L560-L567" + "specLocation": "indices/_types/IndexSettings.ts#L571-L578" }, { "kind": "interface", @@ -128703,7 +128736,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L569-L574" + "specLocation": "indices/_types/IndexSettings.ts#L580-L585" }, { "kind": "interface", @@ -128727,7 +128760,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L576-L583" + "specLocation": "indices/_types/IndexSettings.ts#L587-L594" }, { "kind": "enum", @@ -128839,18 +128872,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", @@ -128873,7 +128929,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L451-L458" + "specLocation": "indices/_types/IndexSettings.ts#L452-L459" }, { "kind": "interface", @@ -128895,7 +128951,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L488-L494" + "specLocation": "indices/_types/IndexSettings.ts#L489-L495" }, { "kind": "interface", @@ -128917,7 +128973,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L479-L486" + "specLocation": "indices/_types/IndexSettings.ts#L480-L487" }, { "kind": "interface", @@ -128940,7 +128996,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L460-L468" + "specLocation": "indices/_types/IndexSettings.ts#L461-L469" }, { "kind": "interface", @@ -128963,7 +129019,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", @@ -129023,7 +129100,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L432-L449" + "specLocation": "indices/_types/IndexSettings.ts#L433-L450" }, { "kind": "interface", @@ -129797,7 +129874,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L496-L501" + "specLocation": "indices/_types/IndexSettings.ts#L507-L512" }, { "kind": "interface", @@ -129851,7 +129928,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L508-L513" + "specLocation": "indices/_types/IndexSettings.ts#L519-L524" }, { "kind": "interface", @@ -129883,7 +129960,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L503-L506" + "specLocation": "indices/_types/IndexSettings.ts#L514-L517" }, { "kind": "interface", @@ -129920,6 +129997,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": { @@ -129951,7 +130047,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L515-L524" + "specLocation": "indices/_types/IndexSettings.ts#L526-L535" }, { "kind": "enum", @@ -129978,7 +130074,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 a36a05a719..97af992514 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5708,6 +5708,7 @@ export interface MappingPropertyBase { ignore_above?: integer dynamic?: MappingDynamicMapping fields?: Record + synthetic_source_keep?: MappingSyntheticSourceKeepEnum } export interface MappingRangePropertyBase extends MappingDocValuesPropertyBase { @@ -5814,6 +5815,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 { @@ -11297,7 +11300,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 { @@ -11320,6 +11324,10 @@ export interface IndicesMappingLimitSettingsNestedObjects { limit?: long } +export interface IndicesMappingLimitSettingsSourceFields { + mode: IndicesSourceMode +} + export interface IndicesMappingLimitSettingsTotalFields { limit?: long | string ignore_dynamic_beyond_limit?: boolean | string @@ -11447,6 +11455,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 8cce8819a2..6ab7b3eb59 100644 --- a/specification/_types/mapping/Property.ts +++ b/specification/_types/mapping/Property.ts @@ -91,6 +91,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