From 3e79bfd352e047c72844f2304c5724991e733580 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 24 Jan 2025 11:16:10 +0400 Subject: [PATCH] Add counted_keyword mapping type --- output/openapi/elasticsearch-openapi.json | 27 ++++++++ .../elasticsearch-serverless-openapi.json | 27 ++++++++ output/schema/schema-serverless.json | 63 ++++++++++++++++--- output/schema/schema.json | 63 ++++++++++++++++--- output/typescript/types.ts | 9 ++- specification/_types/mapping/Property.ts | 3 + specification/_types/mapping/specialized.ts | 9 +++ 7 files changed, 181 insertions(+), 20 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 7811993a1b..c94c7767fc 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -62910,6 +62910,9 @@ { "$ref": "#/components/schemas/_types.mapping:ConstantKeywordProperty" }, + { + "$ref": "#/components/schemas/_types.mapping:CountedKeywordProperty" + }, { "$ref": "#/components/schemas/_types.mapping:FieldAliasProperty" }, @@ -64155,6 +64158,30 @@ } ] }, + "_types.mapping:CountedKeywordProperty": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.mapping:PropertyBase" + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "counted_keyword" + ] + }, + "index": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + }, "_types.mapping:FieldAliasProperty": { "allOf": [ { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 3bd4bc32a6..28a8179f9f 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -40965,6 +40965,9 @@ { "$ref": "#/components/schemas/_types.mapping:ConstantKeywordProperty" }, + { + "$ref": "#/components/schemas/_types.mapping:CountedKeywordProperty" + }, { "$ref": "#/components/schemas/_types.mapping:FieldAliasProperty" }, @@ -42210,6 +42213,30 @@ } ] }, + "_types.mapping:CountedKeywordProperty": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.mapping:PropertyBase" + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "counted_keyword" + ] + }, + "index": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + }, "_types.mapping:FieldAliasProperty": { "allOf": [ { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index f44a5a0683..31185bc0b6 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -53892,6 +53892,9 @@ { "name": "constant_keyword" }, + { + "name": "counted_keyword" + }, { "name": "aggregate_metric_double" }, @@ -53915,7 +53918,7 @@ "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L168-L216" + "specLocation": "_types/mapping/Property.ts#L170-L219" }, { "kind": "enum", @@ -87709,7 +87712,7 @@ "name": "Property", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L97-L166", + "specLocation": "_types/mapping/Property.ts#L98-L168", "type": { "items": [ { @@ -87887,6 +87890,13 @@ "namespace": "_types.mapping" } }, + { + "kind": "instance_of", + "type": { + "name": "CountedKeywordProperty", + "namespace": "_types.mapping" + } + }, { "kind": "instance_of", "type": { @@ -88260,7 +88270,7 @@ } } ], - "specLocation": "_types/mapping/Property.ts#L85-L95" + "specLocation": "_types/mapping/Property.ts#L86-L96" }, { "inherits": { @@ -90569,6 +90579,41 @@ ], "specLocation": "_types/mapping/specialized.ts#L50-L53" }, + { + "inherits": { + "type": { + "name": "PropertyBase", + "namespace": "_types.mapping" + } + }, + "kind": "interface", + "name": { + "name": "CountedKeywordProperty", + "namespace": "_types.mapping" + }, + "properties": [ + { + "name": "type", + "required": true, + "type": { + "kind": "literal_value", + "value": "counted_keyword" + } + }, + { + "name": "index", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "_types/mapping/specialized.ts#L55-L62" + }, { "inherits": { "type": { @@ -90602,7 +90647,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L55-L58" + "specLocation": "_types/mapping/specialized.ts#L64-L67" }, { "inherits": { @@ -90637,7 +90682,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L60-L63" + "specLocation": "_types/mapping/specialized.ts#L69-L72" }, { "inherits": { @@ -90747,7 +90792,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L65-L79" + "specLocation": "_types/mapping/specialized.ts#L74-L88" }, { "inherits": { @@ -90771,7 +90816,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L81-L83" + "specLocation": "_types/mapping/specialized.ts#L90-L92" }, { "inherits": { @@ -90850,7 +90895,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L85-L92" + "specLocation": "_types/mapping/specialized.ts#L94-L101" }, { "inherits": { @@ -92005,7 +92050,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L94-L118" + "specLocation": "_types/mapping/specialized.ts#L103-L127" }, { "kind": "enum", diff --git a/output/schema/schema.json b/output/schema/schema.json index f481125348..6c7ba28a7f 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -75257,6 +75257,41 @@ ], "specLocation": "_types/mapping/core.ts#L45-L48" }, + { + "kind": "interface", + "inherits": { + "type": { + "name": "PropertyBase", + "namespace": "_types.mapping" + } + }, + "name": { + "name": "CountedKeywordProperty", + "namespace": "_types.mapping" + }, + "properties": [ + { + "name": "type", + "required": true, + "type": { + "kind": "literal_value", + "value": "counted_keyword" + } + }, + { + "name": "index", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "_types/mapping/specialized.ts#L55-L62" + }, { "kind": "interface", "name": { @@ -76372,7 +76407,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L55-L58" + "specLocation": "_types/mapping/specialized.ts#L64-L67" }, { "kind": "interface", @@ -76564,6 +76599,9 @@ { "name": "constant_keyword" }, + { + "name": "counted_keyword" + }, { "name": "aggregate_metric_double" }, @@ -76587,7 +76625,7 @@ "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L168-L216" + "specLocation": "_types/mapping/Property.ts#L170-L219" }, { "kind": "interface", @@ -77053,7 +77091,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L60-L63" + "specLocation": "_types/mapping/specialized.ts#L69-L72" }, { "kind": "interface", @@ -77255,7 +77293,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L94-L118" + "specLocation": "_types/mapping/specialized.ts#L103-L127" }, { "kind": "interface", @@ -77467,7 +77505,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L65-L79" + "specLocation": "_types/mapping/specialized.ts#L74-L88" }, { "kind": "interface", @@ -77920,7 +77958,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L81-L83" + "specLocation": "_types/mapping/specialized.ts#L90-L92" }, { "kind": "interface", @@ -78308,7 +78346,7 @@ "name": "Property", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L97-L166", + "specLocation": "_types/mapping/Property.ts#L98-L168", "type": { "kind": "union_of", "items": [ @@ -78487,6 +78525,13 @@ "namespace": "_types.mapping" } }, + { + "kind": "instance_of", + "type": { + "name": "CountedKeywordProperty", + "namespace": "_types.mapping" + } + }, { "kind": "instance_of", "type": { @@ -78770,7 +78815,7 @@ } } ], - "specLocation": "_types/mapping/Property.ts#L85-L95" + "specLocation": "_types/mapping/Property.ts#L86-L96" }, { "kind": "interface", @@ -80059,7 +80104,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L85-L92" + "specLocation": "_types/mapping/specialized.ts#L94-L101" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 9fd7f48976..8563efb89a 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5417,6 +5417,11 @@ export interface MappingCorePropertyBase extends MappingPropertyBase { store?: boolean } +export interface MappingCountedKeywordProperty extends MappingPropertyBase { + type: 'counted_keyword' + index?: boolean +} + export interface MappingDataStreamTimestamp { enabled: boolean } @@ -5537,7 +5542,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' | 'passthrough' | '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' | 'semantic_text' | 'sparse_vector' | 'match_only_text' | 'icu_collation_keyword' +export type MappingFieldType = 'none' | 'geo_point' | 'geo_shape' | 'ip' | 'binary' | 'keyword' | 'text' | 'search_as_you_type' | 'date' | 'date_nanos' | 'boolean' | 'completion' | 'nested' | 'object' | 'passthrough' | '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' | 'counted_keyword' | 'aggregate_metric_double' | 'dense_vector' | 'semantic_text' | 'sparse_vector' | 'match_only_text' | 'icu_collation_keyword' export interface MappingFlattenedProperty extends MappingPropertyBase { boost?: double @@ -5732,7 +5737,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 | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingPassthroughObjectProperty | MappingSemanticTextProperty | MappingSparseVectorProperty | 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 type MappingProperty = MappingBinaryProperty | MappingBooleanProperty | MappingDynamicProperty | MappingJoinProperty | MappingKeywordProperty | MappingMatchOnlyTextProperty | MappingPercolatorProperty | MappingRankFeatureProperty | MappingRankFeaturesProperty | MappingSearchAsYouTypeProperty | MappingTextProperty | MappingVersionProperty | MappingWildcardProperty | MappingDateNanosProperty | MappingDateProperty | MappingAggregateMetricDoubleProperty | MappingDenseVectorProperty | MappingFlattenedProperty | MappingNestedProperty | MappingObjectProperty | MappingPassthroughObjectProperty | MappingSemanticTextProperty | MappingSparseVectorProperty | MappingCompletionProperty | MappingConstantKeywordProperty | MappingCountedKeywordProperty | 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/mapping/Property.ts b/specification/_types/mapping/Property.ts index 80da7a7caa..078d2f573a 100644 --- a/specification/_types/mapping/Property.ts +++ b/specification/_types/mapping/Property.ts @@ -74,6 +74,7 @@ import { DynamicMapping } from './dynamic-template' import { CompletionProperty, ConstantKeywordProperty, + CountedKeywordProperty, FieldAliasProperty, HistogramProperty, IcuCollationProperty, @@ -131,6 +132,7 @@ export type Property = // structured | CompletionProperty | ConstantKeywordProperty + | CountedKeywordProperty | FieldAliasProperty | HistogramProperty | IpProperty @@ -207,6 +209,7 @@ export enum FieldType { shape, histogram, constant_keyword, + counted_keyword, aggregate_metric_double, dense_vector, semantic_text, diff --git a/specification/_types/mapping/specialized.ts b/specification/_types/mapping/specialized.ts index f315850868..c37af9d33e 100644 --- a/specification/_types/mapping/specialized.ts +++ b/specification/_types/mapping/specialized.ts @@ -52,6 +52,15 @@ export class ConstantKeywordProperty extends PropertyBase { type: 'constant_keyword' } +export class CountedKeywordProperty extends PropertyBase { + type: 'counted_keyword' + /* + * Set to false to reduce disk usage for use cases where indexed fields are not required. + * @server_default true + */ + index?: boolean +} + export class FieldAliasProperty extends PropertyBase { path?: Field type: 'alias'