From 7b5e915ba8781d02a1ae27b049f00f481abd075d Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Wed, 5 Jun 2024 11:19:44 +0200 Subject: [PATCH] Add `IcuCollationProperty` (#2599) * Add `IcuCollationProperty` * Fix `IcuCollationTokenFilter` field names * Reformat * Add `norms` and `index_options` * format --------- Co-authored-by: Laura Trotta --- .../elasticsearch-serverless-openapi.json | 86 +++++- output/schema/schema.json | 254 ++++++++++++++++-- output/schema/validation-errors.json | 4 +- output/typescript/types.ts | 33 ++- specification/_types/analysis/icu-plugin.ts | 8 +- specification/_types/mapping/Property.ts | 7 +- specification/_types/mapping/specialized.ts | 36 +++ 7 files changed, 397 insertions(+), 31 deletions(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 8741137a65..6a4924bde4 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -46363,10 +46363,10 @@ "alternate": { "$ref": "#/components/schemas/_types.analysis:IcuCollationAlternate" }, - "caseFirst": { + "case_first": { "$ref": "#/components/schemas/_types.analysis:IcuCollationCaseFirst" }, - "caseLevel": { + "case_level": { "type": "boolean" }, "country": { @@ -46375,7 +46375,7 @@ "decomposition": { "$ref": "#/components/schemas/_types.analysis:IcuCollationDecomposition" }, - "hiraganaQuaternaryMode": { + "hiragana_quaternary_mode": { "type": "boolean" }, "language": { @@ -46390,7 +46390,7 @@ "strength": { "$ref": "#/components/schemas/_types.analysis:IcuCollationStrength" }, - "variableTop": { + "variable_top": { "type": "string" }, "variant": { @@ -48006,6 +48006,9 @@ }, { "$ref": "#/components/schemas/_types.mapping:LongRangeProperty" + }, + { + "$ref": "#/components/schemas/_types.mapping:IcuCollationProperty" } ] }, @@ -49775,6 +49778,81 @@ } ] }, + "_types.mapping:IcuCollationProperty": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.mapping:DocValuesPropertyBase" + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "icu_collation_keyword" + ] + }, + "norms": { + "type": "boolean" + }, + "index_options": { + "$ref": "#/components/schemas/_types.mapping:IndexOptions" + }, + "index": { + "description": "Should the field be searchable?", + "type": "boolean" + }, + "null_value": { + "description": "Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing.", + "type": "string" + }, + "store": { + "description": "Whether the field value should be stored and retrievable separately from the `_source` field.", + "type": "boolean" + }, + "rules": { + "type": "string" + }, + "language": { + "type": "string" + }, + "country": { + "type": "string" + }, + "variant": { + "type": "string" + }, + "strength": { + "$ref": "#/components/schemas/_types.analysis:IcuCollationStrength" + }, + "decomposition": { + "$ref": "#/components/schemas/_types.analysis:IcuCollationDecomposition" + }, + "alternate": { + "$ref": "#/components/schemas/_types.analysis:IcuCollationAlternate" + }, + "case_level": { + "type": "boolean" + }, + "case_first": { + "$ref": "#/components/schemas/_types.analysis:IcuCollationCaseFirst" + }, + "numeric": { + "type": "boolean" + }, + "variable_top": { + "type": "string" + }, + "hiragana_quaternary_mode": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + }, "_types.mapping:MatchType": { "type": "string", "enum": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index 1a0b1281a2..67620822d6 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -64195,7 +64195,7 @@ } }, { - "name": "caseFirst", + "name": "case_first", "required": false, "type": { "kind": "instance_of", @@ -64206,7 +64206,7 @@ } }, { - "name": "caseLevel", + "name": "case_level", "required": false, "type": { "kind": "instance_of", @@ -64239,7 +64239,7 @@ } }, { - "name": "hiraganaQuaternaryMode", + "name": "hiragana_quaternary_mode", "required": false, "type": { "kind": "instance_of", @@ -64294,7 +64294,7 @@ } }, { - "name": "variableTop", + "name": "variable_top", "required": false, "type": { "kind": "instance_of", @@ -69245,7 +69245,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L27-L35" + "specLocation": "_types/mapping/specialized.ts#L33-L41" }, { "inherits": { @@ -69276,7 +69276,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L44-L47" + "specLocation": "_types/mapping/specialized.ts#L50-L53" }, { "inherits": { @@ -70324,7 +70324,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L49-L52" + "specLocation": "_types/mapping/specialized.ts#L55-L58" }, { "kind": "interface", @@ -70524,13 +70524,16 @@ }, { "name": "match_only_text" + }, + { + "name": "icu_collation_keyword" } ], "name": { "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L160-L205" + "specLocation": "_types/mapping/Property.ts#L164-L210" }, { "inherits": { @@ -70996,7 +70999,221 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L54-L57" + "specLocation": "_types/mapping/specialized.ts#L60-L63" + }, + { + "inherits": { + "type": { + "name": "DocValuesPropertyBase", + "namespace": "_types.mapping" + } + }, + "kind": "interface", + "name": { + "name": "IcuCollationProperty", + "namespace": "_types.mapping" + }, + "properties": [ + { + "name": "type", + "required": true, + "type": { + "kind": "literal_value", + "value": "icu_collation_keyword" + } + }, + { + "name": "norms", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "index_options", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexOptions", + "namespace": "_types.mapping" + } + } + }, + { + "description": "Should the field be searchable?", + "name": "index", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing.", + "name": "null_value", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "Whether the field value should be stored and retrievable separately from the `_source` field.", + "name": "store", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "rules", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "language", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "country", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "variant", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "strength", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "IcuCollationStrength", + "namespace": "_types.analysis" + } + } + }, + { + "name": "decomposition", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "IcuCollationDecomposition", + "namespace": "_types.analysis" + } + } + }, + { + "name": "alternate", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "IcuCollationAlternate", + "namespace": "_types.analysis" + } + } + }, + { + "name": "case_level", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "case_first", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "IcuCollationCaseFirst", + "namespace": "_types.analysis" + } + } + }, + { + "name": "numeric", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "variable_top", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "hiragana_quaternary_mode", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "_types/mapping/specialized.ts#L94-L122" }, { "kind": "interface", @@ -71209,7 +71426,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L59-L73" + "specLocation": "_types/mapping/specialized.ts#L65-L79" }, { "inherits": { @@ -71640,7 +71857,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L75-L77" + "specLocation": "_types/mapping/specialized.ts#L81-L83" }, { "inherits": { @@ -71973,7 +72190,7 @@ "name": "Property", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L94-L158", + "specLocation": "_types/mapping/Property.ts#L95-L162", "type": { "items": [ { @@ -72304,6 +72521,13 @@ "name": "LongRangeProperty", "namespace": "_types.mapping" } + }, + { + "kind": "instance_of", + "type": { + "name": "IcuCollationProperty", + "namespace": "_types.mapping" + } } ], "kind": "union_of" @@ -72414,7 +72638,7 @@ } } ], - "specLocation": "_types/mapping/Property.ts#L82-L92" + "specLocation": "_types/mapping/Property.ts#L83-L93" }, { "inherits": { @@ -73226,7 +73450,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L37-L42" + "specLocation": "_types/mapping/specialized.ts#L43-L48" }, { "kind": "enum", @@ -73571,7 +73795,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L79-L86" + "specLocation": "_types/mapping/specialized.ts#L85-L92" }, { "kind": "interface", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index d797ab751d..aabcbfadca 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -465,7 +465,9 @@ "request": [ "Request: query parameter 'flat_settings' does not exist in the json spec" ], - "response": [] + "response": [ + "interface definition _types.mapping:IcuCollationProperty - Property 'store' is already defined in an ancestor class" + ] }, "cluster.post_voting_config_exclusions": { "request": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index ef2783964d..2b5e535696 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -4433,16 +4433,16 @@ export type AnalysisIcuCollationStrength = 'primary' | 'secondary' | 'tertiary' export interface AnalysisIcuCollationTokenFilter extends AnalysisTokenFilterBase { type: 'icu_collation' alternate?: AnalysisIcuCollationAlternate - caseFirst?: AnalysisIcuCollationCaseFirst - caseLevel?: boolean + case_first?: AnalysisIcuCollationCaseFirst + case_level?: boolean country?: string decomposition?: AnalysisIcuCollationDecomposition - hiraganaQuaternaryMode?: boolean + hiragana_quaternary_mode?: boolean language?: string numeric?: boolean rules?: string strength?: AnalysisIcuCollationStrength - variableTop?: string + variable_top?: string variant?: string } @@ -5082,7 +5082,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' | '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 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' | 'icu_collation_keyword' export interface MappingFlattenedProperty extends MappingPropertyBase { boost?: double @@ -5139,6 +5139,27 @@ export interface MappingHistogramProperty extends MappingPropertyBase { type: 'histogram' } +export interface MappingIcuCollationProperty extends MappingDocValuesPropertyBase { + type: 'icu_collation_keyword' + norms?: boolean + index_options?: MappingIndexOptions + index?: boolean + null_value?: string + store?: boolean + rules?: string + language?: string + country?: string + variant?: string + strength?: AnalysisIcuCollationStrength + decomposition?: AnalysisIcuCollationDecomposition + alternate?: AnalysisIcuCollationAlternate + case_level?: boolean + case_first?: AnalysisIcuCollationCaseFirst + numeric?: boolean + variable_top?: string + hiragana_quaternary_mode?: boolean +} + export interface MappingIndexField { enabled: boolean } @@ -5249,7 +5270,7 @@ export interface MappingPointProperty extends MappingDocValuesPropertyBase { type: 'point' } -export type MappingProperty = MappingBinaryProperty | MappingBooleanProperty | MappingDynamicProperty | MappingJoinProperty | MappingKeywordProperty | MappingMatchOnlyTextProperty | MappingPercolatorProperty | MappingRankFeatureProperty | MappingRankFeaturesProperty | MappingSearchAsYouTypeProperty | MappingTextProperty | MappingVersionProperty | MappingWildcardProperty | MappingDateNanosProperty | MappingDateProperty | MappingAggregateMetricDoubleProperty | MappingDenseVectorProperty | MappingSparseVectorProperty | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingCompletionProperty | MappingConstantKeywordProperty | MappingFieldAliasProperty | MappingHistogramProperty | MappingIpProperty | MappingMurmur3HashProperty | MappingTokenCountProperty | MappingGeoPointProperty | MappingGeoShapeProperty | MappingPointProperty | MappingShapeProperty | MappingByteNumberProperty | MappingDoubleNumberProperty | MappingFloatNumberProperty | MappingHalfFloatNumberProperty | MappingIntegerNumberProperty | MappingLongNumberProperty | MappingScaledFloatNumberProperty | MappingShortNumberProperty | MappingUnsignedLongNumberProperty | MappingDateRangeProperty | MappingDoubleRangeProperty | MappingFloatRangeProperty | MappingIntegerRangeProperty | MappingIpRangeProperty | MappingLongRangeProperty +export type MappingProperty = MappingBinaryProperty | MappingBooleanProperty | MappingDynamicProperty | MappingJoinProperty | MappingKeywordProperty | MappingMatchOnlyTextProperty | MappingPercolatorProperty | MappingRankFeatureProperty | MappingRankFeaturesProperty | MappingSearchAsYouTypeProperty | MappingTextProperty | MappingVersionProperty | MappingWildcardProperty | MappingDateNanosProperty | MappingDateProperty | MappingAggregateMetricDoubleProperty | MappingDenseVectorProperty | MappingSparseVectorProperty | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingCompletionProperty | MappingConstantKeywordProperty | MappingFieldAliasProperty | MappingHistogramProperty | MappingIpProperty | MappingMurmur3HashProperty | MappingTokenCountProperty | MappingGeoPointProperty | MappingGeoShapeProperty | MappingPointProperty | MappingShapeProperty | MappingByteNumberProperty | MappingDoubleNumberProperty | MappingFloatNumberProperty | MappingHalfFloatNumberProperty | MappingIntegerNumberProperty | MappingLongNumberProperty | MappingScaledFloatNumberProperty | MappingShortNumberProperty | MappingUnsignedLongNumberProperty | MappingDateRangeProperty | MappingDoubleRangeProperty | MappingFloatRangeProperty | MappingIntegerRangeProperty | MappingIpRangeProperty | MappingLongRangeProperty | MappingIcuCollationProperty export interface MappingPropertyBase { meta?: Record diff --git a/specification/_types/analysis/icu-plugin.ts b/specification/_types/analysis/icu-plugin.ts index c16b9a0813..136b27550c 100644 --- a/specification/_types/analysis/icu-plugin.ts +++ b/specification/_types/analysis/icu-plugin.ts @@ -51,16 +51,16 @@ export class IcuFoldingTokenFilter extends TokenFilterBase { export class IcuCollationTokenFilter extends TokenFilterBase { type: 'icu_collation' alternate?: IcuCollationAlternate - caseFirst?: IcuCollationCaseFirst - caseLevel?: boolean + case_first?: IcuCollationCaseFirst + case_level?: boolean country?: string decomposition?: IcuCollationDecomposition - hiraganaQuaternaryMode?: boolean + hiragana_quaternary_mode?: boolean language?: string numeric?: boolean rules?: string strength?: IcuCollationStrength - variableTop?: string + variable_top?: string variant?: string } diff --git a/specification/_types/mapping/Property.ts b/specification/_types/mapping/Property.ts index 1d05ec0b74..53c2787cdd 100644 --- a/specification/_types/mapping/Property.ts +++ b/specification/_types/mapping/Property.ts @@ -60,6 +60,7 @@ import { ConstantKeywordProperty, FieldAliasProperty, HistogramProperty, + IcuCollationProperty, IpProperty, Murmur3HashProperty, TokenCountProperty @@ -157,6 +158,9 @@ export type Property = | IpRangeProperty | LongRangeProperty + // plugins + | IcuCollationProperty + export enum FieldType { none, geo_point, @@ -201,7 +205,8 @@ export enum FieldType { aggregate_metric_double, dense_vector, sparse_vector, - match_only_text + match_only_text, + icu_collation_keyword } export class PropertyWithClrOrigin {} diff --git a/specification/_types/mapping/specialized.ts b/specification/_types/mapping/specialized.ts index 984200039e..92f1400b46 100644 --- a/specification/_types/mapping/specialized.ts +++ b/specification/_types/mapping/specialized.ts @@ -23,6 +23,12 @@ import { double, integer } from '@_types/Numeric' import { DocValuesPropertyBase, IndexOptions, OnScriptError } from './core' import { PropertyBase } from './Property' import { Script } from '@_types/Scripting' +import { + IcuCollationAlternate, + IcuCollationCaseFirst, + IcuCollationDecomposition, + IcuCollationStrength +} from '@_types/analysis/icu-plugin' export class CompletionProperty extends DocValuesPropertyBase { analyzer?: string @@ -84,3 +90,33 @@ export class TokenCountProperty extends DocValuesPropertyBase { enable_position_increments?: boolean type: 'token_count' } + +export class IcuCollationProperty extends DocValuesPropertyBase { + type: 'icu_collation_keyword' + norms?: boolean + index_options?: IndexOptions + /** + * Should the field be searchable? + */ + index?: boolean + /** + * Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing. + */ + null_value?: string + /** + * Whether the field value should be stored and retrievable separately from the `_source` field. + */ + store?: boolean + rules?: string + language?: string + country?: string + variant?: string + strength?: IcuCollationStrength + decomposition?: IcuCollationDecomposition + alternate?: IcuCollationAlternate + case_level?: boolean + case_first?: IcuCollationCaseFirst + numeric?: boolean + variable_top?: string + hiragana_quaternary_mode?: boolean +}