From 00a1f84e815ceb90a42e7b7136036f7dcaf48422 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Wed, 8 May 2024 15:36:16 +0200 Subject: [PATCH 1/5] range for aggregations should just accept double (666) --- .../elasticsearch-serverless-openapi.json | 26 +-------- output/schema/schema.json | 58 ++++--------------- output/typescript/types.ts | 4 +- specification/_types/aggregations/bucket.ts | 4 +- 4 files changed, 16 insertions(+), 76 deletions(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 1b8915a2a2..b8b657045c 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -39537,18 +39537,7 @@ "properties": { "from": { "description": "Start of the range (inclusive).", - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "nullable": true, - "type": "string" - } - ] + "type": "number" }, "key": { "description": "Custom key to return the range with.", @@ -39556,18 +39545,7 @@ }, "to": { "description": "End of the range (exclusive).", - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "nullable": true, - "type": "string" - } - ] + "type": "number" } } }, diff --git a/output/schema/schema.json b/output/schema/schema.json index 85285f2676..336cefc8c4 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -51316,30 +51316,11 @@ "name": "from", "required": false, "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - { - "kind": "instance_of", - "type": { - "name": "null", - "namespace": "_builtins" - } - } - ], - "kind": "union_of" + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } } }, { @@ -51359,30 +51340,11 @@ "name": "to", "required": false, "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - { - "kind": "instance_of", - "type": { - "name": "null", - "namespace": "_builtins" - } - } - ], - "kind": "union_of" + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } } } ], diff --git a/output/typescript/types.ts b/output/typescript/types.ts index af1bacc5cf..426fd6b50b 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2959,9 +2959,9 @@ export interface AggregationsAggregationContainer { } export interface AggregationsAggregationRange { - from?: double | string | null + from?: double key?: string - to?: double | string | null + to?: double } export interface AggregationsArrayPercentilesItem { diff --git a/specification/_types/aggregations/bucket.ts b/specification/_types/aggregations/bucket.ts index 024e56f38a..0445f5e144 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -675,7 +675,7 @@ export class AggregationRange { /** * Start of the range (inclusive). */ - from?: double | string | null + from?: double /** * Custom key to return the range with. */ @@ -683,7 +683,7 @@ export class AggregationRange { /** * End of the range (exclusive). */ - to?: double | string | null + to?: double } export class RareTermsAggregation extends BucketAggregationBase { From 023cc7e51e5a501966fffc4b7a616f011d971461 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Wed, 8 May 2024 16:11:36 +0200 Subject: [PATCH 2/5] added version to fieldType enum (673) --- output/schema/schema.json | 5 ++++- output/typescript/types.ts | 2 +- specification/_types/mapping/Property.ts | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index 336cefc8c4..d622fea8e2 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -69944,6 +69944,9 @@ { "name": "object" }, + { + "name": "version" + }, { "name": "murmur3" }, @@ -70036,7 +70039,7 @@ "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L160-L204" + "specLocation": "_types/mapping/Property.ts#L160-L205" }, { "inherits": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 426fd6b50b..a55e936e6e 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5045,7 +5045,7 @@ export interface MappingFieldNamesField { enabled: boolean } -export type MappingFieldType = 'none' | 'geo_point' | 'geo_shape' | 'ip' | 'binary' | 'keyword' | 'text' | 'search_as_you_type' | 'date' | 'date_nanos' | 'boolean' | 'completion' | 'nested' | 'object' | 'murmur3' | 'token_count' | 'percolator' | 'integer' | 'long' | 'short' | 'byte' | 'float' | 'half_float' | 'scaled_float' | 'double' | 'integer_range' | 'float_range' | 'long_range' | 'double_range' | 'date_range' | 'ip_range' | 'alias' | 'join' | 'rank_feature' | 'rank_features' | 'flattened' | 'shape' | 'histogram' | 'constant_keyword' | 'aggregate_metric_double' | 'dense_vector' | 'sparse_vector' | 'match_only_text' +export type MappingFieldType = 'none' | 'geo_point' | 'geo_shape' | 'ip' | 'binary' | 'keyword' | 'text' | 'search_as_you_type' | 'date' | 'date_nanos' | 'boolean' | 'completion' | 'nested' | 'object' | 'version' | 'murmur3' | 'token_count' | 'percolator' | 'integer' | 'long' | 'short' | 'byte' | 'float' | 'half_float' | 'scaled_float' | 'double' | 'integer_range' | 'float_range' | 'long_range' | 'double_range' | 'date_range' | 'ip_range' | 'alias' | 'join' | 'rank_feature' | 'rank_features' | 'flattened' | 'shape' | 'histogram' | 'constant_keyword' | 'aggregate_metric_double' | 'dense_vector' | 'sparse_vector' | 'match_only_text' export interface MappingFlattenedProperty extends MappingPropertyBase { boost?: double diff --git a/specification/_types/mapping/Property.ts b/specification/_types/mapping/Property.ts index 26f04432f4..1d05ec0b74 100644 --- a/specification/_types/mapping/Property.ts +++ b/specification/_types/mapping/Property.ts @@ -172,6 +172,7 @@ export enum FieldType { completion, nested, object, + version, murmur3, token_count, percolator, From f7fb63a286719499937680364fdfffd882200de4 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Fri, 10 May 2024 12:08:28 +0200 Subject: [PATCH 3/5] script field missing from keywordProperty (690) --- .../elasticsearch-serverless-openapi.json | 6 ++ output/schema/schema.json | 70 ++++++++++++------- output/typescript/types.ts | 2 + specification/_types/mapping/core.ts | 2 + 4 files changed, 56 insertions(+), 24 deletions(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index b8b657045c..c100488314 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -47781,6 +47781,12 @@ "index_options": { "$ref": "#/components/schemas/_types.mapping:IndexOptions" }, + "script": { + "$ref": "#/components/schemas/_types:Script" + }, + "on_script_error": { + "$ref": "#/components/schemas/_types.mapping:OnScriptError" + }, "normalizer": { "type": "string" }, diff --git a/output/schema/schema.json b/output/schema/schema.json index d622fea8e2..55904d65c8 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -68783,7 +68783,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L164-L167" + "specLocation": "_types/mapping/core.ts#L166-L169" }, { "inherits": { @@ -69398,7 +69398,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L144-L147" + "specLocation": "_types/mapping/core.ts#L146-L149" }, { "inherits": { @@ -69711,7 +69711,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L286-L317" + "specLocation": "_types/mapping/core.ts#L288-L319" }, { "kind": "interface", @@ -70197,7 +70197,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L134-L137" + "specLocation": "_types/mapping/core.ts#L136-L139" }, { "inherits": { @@ -70470,7 +70470,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L139-L142" + "specLocation": "_types/mapping/core.ts#L141-L144" }, { "inherits": { @@ -70548,7 +70548,7 @@ "name": "IndexOptions", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L243-L248" + "specLocation": "_types/mapping/core.ts#L245-L250" }, { "inherits": { @@ -70583,7 +70583,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L149-L152" + "specLocation": "_types/mapping/core.ts#L151-L154" }, { "inherits": { @@ -70873,6 +70873,28 @@ } } }, + { + "name": "script", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Script", + "namespace": "_types" + } + } + }, + { + "name": "on_script_error", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "OnScriptError", + "namespace": "_types.mapping" + } + } + }, { "name": "normalizer", "required": false, @@ -70947,7 +70969,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L89-L105" + "specLocation": "_types/mapping/core.ts#L89-L107" }, { "inherits": { @@ -70982,7 +71004,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L154-L157" + "specLocation": "_types/mapping/core.ts#L156-L159" }, { "inherits": { @@ -71087,7 +71109,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L216-L241" + "specLocation": "_types/mapping/core.ts#L218-L243" }, { "kind": "enum", @@ -71309,7 +71331,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L107-L127" + "specLocation": "_types/mapping/core.ts#L109-L129" }, { "inherits": { @@ -71371,7 +71393,7 @@ "name": "OnScriptError", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L129-L132" + "specLocation": "_types/mapping/core.ts#L131-L134" }, { "inherits": { @@ -71395,7 +71417,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L180-L182" + "specLocation": "_types/mapping/core.ts#L182-L184" }, { "inherits": { @@ -71985,7 +72007,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L184-L187" + "specLocation": "_types/mapping/core.ts#L186-L189" }, { "inherits": { @@ -72020,7 +72042,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L189-L192" + "specLocation": "_types/mapping/core.ts#L191-L194" }, { "kind": "interface", @@ -72282,7 +72304,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L174-L178" + "specLocation": "_types/mapping/core.ts#L176-L180" }, { "inherits": { @@ -72394,7 +72416,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L198-L208" + "specLocation": "_types/mapping/core.ts#L200-L210" }, { "description": "The `shape` data type facilitates the indexing of and searching with arbitrary `x, y` cartesian shapes such as\nrectangles and polygons.", @@ -72500,7 +72522,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L159-L162" + "specLocation": "_types/mapping/core.ts#L161-L164" }, { "kind": "interface", @@ -72647,7 +72669,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L194-L196" + "specLocation": "_types/mapping/core.ts#L196-L198" }, { "kind": "interface", @@ -72776,7 +72798,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L250-L253" + "specLocation": "_types/mapping/core.ts#L252-L255" }, { "inherits": { @@ -72954,7 +72976,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L255-L271" + "specLocation": "_types/mapping/core.ts#L257-L273" }, { "kind": "enum", @@ -73338,7 +73360,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L169-L172" + "specLocation": "_types/mapping/core.ts#L171-L174" }, { "inherits": { @@ -73362,7 +73384,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L273-L275" + "specLocation": "_types/mapping/core.ts#L275-L277" }, { "inherits": { @@ -73404,7 +73426,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L277-L284" + "specLocation": "_types/mapping/core.ts#L279-L286" }, { "inherits": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index a55e936e6e..0c4e88fc22 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5143,6 +5143,8 @@ export interface MappingKeywordProperty extends MappingDocValuesPropertyBase { eager_global_ordinals?: boolean index?: boolean index_options?: MappingIndexOptions + script?: Script + on_script_error?: MappingOnScriptError normalizer?: string norms?: boolean null_value?: string diff --git a/specification/_types/mapping/core.ts b/specification/_types/mapping/core.ts index ddd44429a0..5eaae7cec3 100644 --- a/specification/_types/mapping/core.ts +++ b/specification/_types/mapping/core.ts @@ -91,6 +91,8 @@ export class KeywordProperty extends DocValuesPropertyBase { eager_global_ordinals?: boolean index?: boolean index_options?: IndexOptions + script?: Script + on_script_error?: OnScriptError normalizer?: string norms?: boolean null_value?: string From 019377ad609386277e993e8a1c8ce9397b237b79 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Wed, 8 May 2024 17:02:16 +0200 Subject: [PATCH 4/5] default variant for normalizers (696) --- output/schema/schema.json | 1 + specification/_types/analysis/normalizers.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index 55904d65c8..086aadd6c6 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -65667,6 +65667,7 @@ "kind": "union_of" }, "variants": { + "defaultTag": "custom", "kind": "internal_tag", "tag": "type" } diff --git a/specification/_types/analysis/normalizers.ts b/specification/_types/analysis/normalizers.ts index f1e98635ad..d6f6789641 100644 --- a/specification/_types/analysis/normalizers.ts +++ b/specification/_types/analysis/normalizers.ts @@ -18,7 +18,7 @@ */ /** - * @variants internal tag='type' + * @variants internal tag='type' default='custom' * @doc_id analysis-normalizers */ export type Normalizer = LowercaseNormalizer | CustomNormalizer From a5d5a798536682e78fe648bd840441e3ed3779ed Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Fri, 10 May 2024 12:41:03 +0200 Subject: [PATCH 5/5] remodeled dynamic template (648) --- .../elasticsearch-serverless-openapi.json | 121 +++++++++--- output/schema/schema.json | 186 +++++++++++++++--- output/typescript/types.ts | 12 +- .../_types/mapping/dynamic-template.ts | 22 ++- 4 files changed, 277 insertions(+), 64 deletions(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index c100488314..f47fe238f7 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -47267,30 +47267,107 @@ ] }, "_types.mapping:DynamicTemplate": { - "type": "object", - "properties": { - "mapping": { - "$ref": "#/components/schemas/_types.mapping:Property" - }, - "match": { - "type": "string" - }, - "match_mapping_type": { - "type": "string" - }, - "match_pattern": { - "$ref": "#/components/schemas/_types.mapping:MatchType" - }, - "path_match": { - "type": "string" - }, - "path_unmatch": { - "type": "string" + "allOf": [ + { + "type": "object", + "properties": { + "match": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "path_match": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "unmatch": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "path_unmatch": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "match_mapping_type": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "unmatch_mapping_type": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "match_pattern": { + "$ref": "#/components/schemas/_types.mapping:MatchType" + } + } }, - "unmatch": { - "type": "string" + { + "type": "object", + "properties": { + "mapping": { + "$ref": "#/components/schemas/_types.mapping:Property" + }, + "runtime": { + "$ref": "#/components/schemas/_types.mapping:Property" + } + }, + "minProperties": 1, + "maxProperties": 1 } - } + ] }, "_types.mapping:Property": { "discriminator": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 086aadd6c6..b556f7e8a7 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -69446,7 +69446,7 @@ "name": "DynamicMapping", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/dynamic-template.ts#L37-L46" + "specLocation": "_types/mapping/dynamic-template.ts#L49-L58" }, { "inherits": { @@ -69733,73 +69733,195 @@ } }, { - "name": "match", + "name": "runtime", "required": false, "type": { "kind": "instance_of", "type": { - "name": "string", - "namespace": "_builtins" + "name": "Property", + "namespace": "_types.mapping" } } }, { - "name": "match_mapping_type", + "containerProperty": true, + "name": "match", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "kind": "union_of" } }, { - "name": "match_pattern", + "containerProperty": true, + "name": "path_match", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "MatchType", - "namespace": "_types.mapping" - } + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "kind": "union_of" } }, { - "name": "path_match", + "containerProperty": true, + "name": "unmatch", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "kind": "union_of" } }, { + "containerProperty": true, "name": "path_unmatch", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "kind": "union_of" } }, { - "name": "unmatch", + "containerProperty": true, + "name": "match_mapping_type", + "required": false, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "kind": "union_of" + } + }, + { + "containerProperty": true, + "name": "unmatch_mapping_type", + "required": false, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "kind": "union_of" + } + }, + { + "containerProperty": true, + "name": "match_pattern", "required": false, "type": { "kind": "instance_of", "type": { - "name": "string", - "namespace": "_builtins" + "name": "MatchType", + "namespace": "_types.mapping" } } } ], - "specLocation": "_types/mapping/dynamic-template.ts#L22-L30" + "specLocation": "_types/mapping/dynamic-template.ts#L22-L42", + "variants": { + "kind": "container" + } }, { "inherits": { @@ -71126,7 +71248,7 @@ "name": "MatchType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/dynamic-template.ts#L32-L35" + "specLocation": "_types/mapping/dynamic-template.ts#L44-L47" }, { "inherits": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 0c4e88fc22..fb4fe2e8f9 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5023,12 +5023,14 @@ export interface MappingDynamicProperty extends MappingDocValuesPropertyBase { export interface MappingDynamicTemplate { mapping?: MappingProperty - match?: string - match_mapping_type?: string + runtime?: MappingProperty + match?: string | string[] + path_match?: string | string[] + unmatch?: string | string[] + path_unmatch?: string | string[] + match_mapping_type?: string | string[] + unmatch_mapping_type?: string | string[] match_pattern?: MappingMatchType - path_match?: string - path_unmatch?: string - unmatch?: string } export interface MappingFieldAliasProperty extends MappingPropertyBase { diff --git a/specification/_types/mapping/dynamic-template.ts b/specification/_types/mapping/dynamic-template.ts index baf04bf7c5..294690d623 100644 --- a/specification/_types/mapping/dynamic-template.ts +++ b/specification/_types/mapping/dynamic-template.ts @@ -19,14 +19,26 @@ import { Property } from './Property' +/** + * @variants container + */ export class DynamicTemplate { mapping?: Property - match?: string - match_mapping_type?: string + runtime?: Property + /** @variant container_property */ + match?: string | string[] + /** @variant container_property */ + path_match?: string | string[] + /** @variant container_property */ + unmatch?: string | string[] + /** @variant container_property */ + path_unmatch?: string | string[] + /** @variant container_property */ + match_mapping_type?: string | string[] + /** @variant container_property */ + unmatch_mapping_type?: string | string[] + /** @variant container_property */ match_pattern?: MatchType - path_match?: string - path_unmatch?: string - unmatch?: string } export enum MatchType {