From 795eb8d24d2d1aba705915e50b4487c848be8b57 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 23 Sep 2024 11:44:04 +0400 Subject: [PATCH] Fix get field mapping API response (#2894) --- output/openapi/elasticsearch-openapi.json | 56 ++++++- .../elasticsearch-serverless-openapi.json | 56 ++++++- output/schema/schema-serverless.json | 156 +++++++++++++----- output/schema/schema.json | 156 +++++++++++++----- output/typescript/types.ts | 8 +- specification/_types/mapping/core.ts | 8 +- 6 files changed, 350 insertions(+), 90 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 8c6c15eb4..cecf20f21 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -60542,9 +60542,6 @@ "copy_to": { "$ref": "#/components/schemas/_types:Fields" }, - "similarity": { - "type": "string" - }, "store": { "type": "boolean" } @@ -60690,7 +60687,15 @@ "type": "boolean" }, "index_prefixes": { - "$ref": "#/components/schemas/_types.mapping:TextIndexPrefixes" + "oneOf": [ + { + "$ref": "#/components/schemas/_types.mapping:TextIndexPrefixes" + }, + { + "nullable": true, + "type": "string" + } + ] }, "norms": { "type": "boolean" @@ -60851,6 +60856,17 @@ "null_value": { "type": "string" }, + "similarity": { + "oneOf": [ + { + "type": "string" + }, + { + "nullable": true, + "type": "string" + } + ] + }, "split_queries_on_whitespace": { "type": "boolean" }, @@ -61007,6 +61023,17 @@ "search_quote_analyzer": { "type": "string" }, + "similarity": { + "oneOf": [ + { + "type": "string" + }, + { + "nullable": true, + "type": "string" + } + ] + }, "term_vector": { "$ref": "#/components/schemas/_types.mapping:TermVectorOption" }, @@ -61056,7 +61083,15 @@ "type": "boolean" }, "index_prefixes": { - "$ref": "#/components/schemas/_types.mapping:TextIndexPrefixes" + "oneOf": [ + { + "$ref": "#/components/schemas/_types.mapping:TextIndexPrefixes" + }, + { + "nullable": true, + "type": "string" + } + ] }, "norms": { "type": "boolean" @@ -61070,6 +61105,17 @@ "search_quote_analyzer": { "type": "string" }, + "similarity": { + "oneOf": [ + { + "type": "string" + }, + { + "nullable": true, + "type": "string" + } + ] + }, "term_vector": { "$ref": "#/components/schemas/_types.mapping:TermVectorOption" }, diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index ee70c1b85..49287a3ed 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -41396,9 +41396,6 @@ "copy_to": { "$ref": "#/components/schemas/_types:Fields" }, - "similarity": { - "type": "string" - }, "store": { "type": "boolean" } @@ -41544,7 +41541,15 @@ "type": "boolean" }, "index_prefixes": { - "$ref": "#/components/schemas/_types.mapping:TextIndexPrefixes" + "oneOf": [ + { + "$ref": "#/components/schemas/_types.mapping:TextIndexPrefixes" + }, + { + "nullable": true, + "type": "string" + } + ] }, "norms": { "type": "boolean" @@ -41705,6 +41710,17 @@ "null_value": { "type": "string" }, + "similarity": { + "oneOf": [ + { + "type": "string" + }, + { + "nullable": true, + "type": "string" + } + ] + }, "split_queries_on_whitespace": { "type": "boolean" }, @@ -41861,6 +41877,17 @@ "search_quote_analyzer": { "type": "string" }, + "similarity": { + "oneOf": [ + { + "type": "string" + }, + { + "nullable": true, + "type": "string" + } + ] + }, "term_vector": { "$ref": "#/components/schemas/_types.mapping:TermVectorOption" }, @@ -41910,7 +41937,15 @@ "type": "boolean" }, "index_prefixes": { - "$ref": "#/components/schemas/_types.mapping:TextIndexPrefixes" + "oneOf": [ + { + "$ref": "#/components/schemas/_types.mapping:TextIndexPrefixes" + }, + { + "nullable": true, + "type": "string" + } + ] }, "norms": { "type": "boolean" @@ -41924,6 +41959,17 @@ "search_quote_analyzer": { "type": "string" }, + "similarity": { + "oneOf": [ + { + "type": "string" + }, + { + "nullable": true, + "type": "string" + } + ] + }, "term_vector": { "$ref": "#/components/schemas/_types.mapping:TermVectorOption" }, diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index d7c01c9f0..405bf4baa 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -84917,7 +84917,7 @@ "name": "IndexOptions", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L257-L262" + "specLocation": "_types/mapping/core.ts#L258-L263" }, { "kind": "enum", @@ -85335,7 +85335,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L55-L57" + "specLocation": "_types/mapping/core.ts#L54-L56" }, { "inherits": { @@ -85362,7 +85362,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L51-L53" + "specLocation": "_types/mapping/core.ts#L50-L52" }, { "inherits": { @@ -85388,17 +85388,6 @@ } } }, - { - "name": "similarity", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, { "name": "store", "required": false, @@ -85411,7 +85400,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L45-L49" + "specLocation": "_types/mapping/core.ts#L45-L48" }, { "kind": "interface", @@ -85580,7 +85569,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L59-L65" + "specLocation": "_types/mapping/core.ts#L58-L64" }, { "kind": "interface", @@ -85787,11 +85776,23 @@ "name": "index_prefixes", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "TextIndexPrefixes", - "namespace": "_types.mapping" - } + "items": [ + { + "kind": "instance_of", + "type": { + "name": "TextIndexPrefixes", + "namespace": "_types.mapping" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ], + "kind": "union_of" } }, { @@ -85883,7 +85884,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L300-L331" + "specLocation": "_types/mapping/core.ts#L302-L333" }, { "kind": "enum", @@ -85940,7 +85941,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L264-L267" + "specLocation": "_types/mapping/core.ts#L265-L268" }, { "kind": "enum", @@ -86043,7 +86044,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L89-L93" + "specLocation": "_types/mapping/core.ts#L88-L92" }, { "inherits": { @@ -86157,6 +86158,29 @@ } } }, + { + "name": "similarity", + "required": false, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ], + "kind": "union_of" + } + }, { "name": "split_queries_on_whitespace", "required": false, @@ -86197,7 +86221,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L95-L113" + "specLocation": "_types/mapping/core.ts#L94-L113" }, { "description": "A variant of text that trades scoring and efficiency of positional queries for space efficiency. This field\neffectively stores data the same way as a text field that only indexes documents (index_options: docs) and\ndisables norms (norms: false). Term queries perform as fast if not faster as on text fields, however queries\nthat need positions such as the match_phrase query perform slower as they need to look at the _source document\nto verify whether a phrase matches. All queries return constant scores that are equal to 1.0.", @@ -86278,7 +86302,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L230-L255" + "specLocation": "_types/mapping/core.ts#L231-L256" }, { "inherits": { @@ -86464,6 +86488,29 @@ } } }, + { + "name": "similarity", + "required": false, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ], + "kind": "union_of" + } + }, { "name": "term_vector", "required": false, @@ -86484,7 +86531,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L212-L222" + "specLocation": "_types/mapping/core.ts#L212-L223" }, { "inherits": { @@ -86591,11 +86638,23 @@ "name": "index_prefixes", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "TextIndexPrefixes", - "namespace": "_types.mapping" - } + "items": [ + { + "kind": "instance_of", + "type": { + "name": "TextIndexPrefixes", + "namespace": "_types.mapping" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ], + "kind": "union_of" } }, { @@ -86642,6 +86701,29 @@ } } }, + { + "name": "similarity", + "required": false, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ], + "kind": "union_of" + } + }, { "name": "term_vector", "required": false, @@ -86662,7 +86744,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L269-L285" + "specLocation": "_types/mapping/core.ts#L270-L287" }, { "kind": "interface", @@ -86729,7 +86811,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L287-L289" + "specLocation": "_types/mapping/core.ts#L289-L291" }, { "inherits": { @@ -86770,7 +86852,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L291-L298" + "specLocation": "_types/mapping/core.ts#L293-L300" }, { "inherits": { @@ -86860,7 +86942,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L79-L87" + "specLocation": "_types/mapping/core.ts#L78-L86" }, { "inherits": { @@ -86972,7 +87054,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L67-L77" + "specLocation": "_types/mapping/core.ts#L66-L76" }, { "inherits": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 1d7b6bbe6..28a3234af 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -71253,7 +71253,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L55-L57" + "specLocation": "_types/mapping/core.ts#L54-L56" }, { "kind": "interface", @@ -71321,7 +71321,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L59-L65" + "specLocation": "_types/mapping/core.ts#L58-L64" }, { "kind": "interface", @@ -71527,17 +71527,6 @@ } } }, - { - "name": "similarity", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, { "name": "store", "required": false, @@ -71550,7 +71539,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L45-L49" + "specLocation": "_types/mapping/core.ts#L45-L48" }, { "kind": "interface", @@ -71661,7 +71650,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L79-L87" + "specLocation": "_types/mapping/core.ts#L78-L86" }, { "kind": "interface", @@ -71773,7 +71762,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L67-L77" + "specLocation": "_types/mapping/core.ts#L66-L76" }, { "kind": "interface", @@ -71968,7 +71957,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L51-L53" + "specLocation": "_types/mapping/core.ts#L50-L52" }, { "kind": "interface", @@ -72220,11 +72209,23 @@ "name": "index_prefixes", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "TextIndexPrefixes", - "namespace": "_types.mapping" - } + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "TextIndexPrefixes", + "namespace": "_types.mapping" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ] } }, { @@ -72316,7 +72317,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L300-L331" + "specLocation": "_types/mapping/core.ts#L302-L333" }, { "kind": "interface", @@ -73483,7 +73484,7 @@ "name": "IndexOptions", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L257-L262" + "specLocation": "_types/mapping/core.ts#L258-L263" }, { "kind": "interface", @@ -73748,7 +73749,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L89-L93" + "specLocation": "_types/mapping/core.ts#L88-L92" }, { "kind": "interface", @@ -73862,6 +73863,29 @@ } } }, + { + "name": "similarity", + "required": false, + "type": { + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ] + } + }, { "name": "split_queries_on_whitespace", "required": false, @@ -73902,7 +73926,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L95-L113" + "specLocation": "_types/mapping/core.ts#L94-L113" }, { "kind": "interface", @@ -74042,7 +74066,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L230-L255" + "specLocation": "_types/mapping/core.ts#L231-L256" }, { "kind": "enum", @@ -75364,6 +75388,29 @@ } } }, + { + "name": "similarity", + "required": false, + "type": { + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ] + } + }, { "name": "term_vector", "required": false, @@ -75384,7 +75431,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L212-L222" + "specLocation": "_types/mapping/core.ts#L212-L223" }, { "kind": "interface", @@ -75817,7 +75864,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L264-L267" + "specLocation": "_types/mapping/core.ts#L265-L268" }, { "kind": "interface", @@ -75924,11 +75971,23 @@ "name": "index_prefixes", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "TextIndexPrefixes", - "namespace": "_types.mapping" - } + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "TextIndexPrefixes", + "namespace": "_types.mapping" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ] } }, { @@ -75975,6 +76034,29 @@ } } }, + { + "name": "similarity", + "required": false, + "type": { + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ] + } + }, { "name": "term_vector", "required": false, @@ -75995,7 +76077,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L269-L285" + "specLocation": "_types/mapping/core.ts#L270-L287" }, { "kind": "enum", @@ -76402,7 +76484,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L287-L289" + "specLocation": "_types/mapping/core.ts#L289-L291" }, { "kind": "interface", @@ -76443,7 +76525,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L291-L298" + "specLocation": "_types/mapping/core.ts#L293-L300" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 5e764c286..c87a3ad2e 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5281,7 +5281,6 @@ export interface MappingConstantKeywordProperty extends MappingPropertyBase { export interface MappingCorePropertyBase extends MappingPropertyBase { copy_to?: Fields - similarity?: string store?: boolean } @@ -5362,7 +5361,7 @@ export interface MappingDynamicProperty extends MappingDocValuesPropertyBase { index?: boolean index_options?: MappingIndexOptions index_phrases?: boolean - index_prefixes?: MappingTextIndexPrefixes + index_prefixes?: MappingTextIndexPrefixes | null norms?: boolean position_increment_gap?: integer search_analyzer?: string @@ -5522,6 +5521,7 @@ export interface MappingKeywordProperty extends MappingDocValuesPropertyBase { normalizer?: string norms?: boolean null_value?: string + similarity?: string | null split_queries_on_whitespace?: boolean time_series_dimension?: boolean type: 'keyword' @@ -5650,6 +5650,7 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase norms?: boolean search_analyzer?: string search_quote_analyzer?: string + similarity?: string | null term_vector?: MappingTermVectorOption type: 'search_as_you_type' } @@ -5715,11 +5716,12 @@ export interface MappingTextProperty extends MappingCorePropertyBase { index?: boolean index_options?: MappingIndexOptions index_phrases?: boolean - index_prefixes?: MappingTextIndexPrefixes + index_prefixes?: MappingTextIndexPrefixes | null norms?: boolean position_increment_gap?: integer search_analyzer?: string search_quote_analyzer?: string + similarity?: string | null term_vector?: MappingTermVectorOption type: 'text' } diff --git a/specification/_types/mapping/core.ts b/specification/_types/mapping/core.ts index 6653e212d..aa25c6d09 100644 --- a/specification/_types/mapping/core.ts +++ b/specification/_types/mapping/core.ts @@ -44,7 +44,6 @@ import { TimeSeriesMetricType } from './TimeSeriesMetricType' export class CorePropertyBase extends PropertyBase { copy_to?: Fields - similarity?: string store?: boolean } @@ -102,6 +101,7 @@ export class KeywordProperty extends DocValuesPropertyBase { normalizer?: string norms?: boolean null_value?: string + similarity?: string | null split_queries_on_whitespace?: boolean /** * For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. @@ -217,6 +217,7 @@ export class SearchAsYouTypeProperty extends CorePropertyBase { norms?: boolean search_analyzer?: string search_quote_analyzer?: string + similarity?: string | null term_vector?: TermVectorOption type: 'search_as_you_type' } @@ -275,11 +276,12 @@ export class TextProperty extends CorePropertyBase { index?: boolean index_options?: IndexOptions index_phrases?: boolean - index_prefixes?: TextIndexPrefixes + index_prefixes?: TextIndexPrefixes | null norms?: boolean position_increment_gap?: integer search_analyzer?: string search_quote_analyzer?: string + similarity?: string | null term_vector?: TermVectorOption type: 'text' } @@ -317,7 +319,7 @@ export class DynamicProperty extends DocValuesPropertyBase { index?: boolean index_options?: IndexOptions index_phrases?: boolean - index_prefixes?: TextIndexPrefixes + index_prefixes?: TextIndexPrefixes | null norms?: boolean position_increment_gap?: integer search_analyzer?: string