From b267148ef230772ce854f4b151994f6d44cbf9b7 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 24 Jan 2025 15:01:31 +0400 Subject: [PATCH] Add counted_keyword mapping type (#3595) (cherry picked from commit 2034603ffbef8f99e3cd445d2e3651a243b71133) --- 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 81920f20b4..f51b79810e 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -63009,6 +63009,9 @@ { "$ref": "#/components/schemas/_types.mapping:ConstantKeywordProperty" }, + { + "$ref": "#/components/schemas/_types.mapping:CountedKeywordProperty" + }, { "$ref": "#/components/schemas/_types.mapping:FieldAliasProperty" }, @@ -64254,6 +64257,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 8b01804575..e126b747a8 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -40992,6 +40992,9 @@ { "$ref": "#/components/schemas/_types.mapping:ConstantKeywordProperty" }, + { + "$ref": "#/components/schemas/_types.mapping:CountedKeywordProperty" + }, { "$ref": "#/components/schemas/_types.mapping:FieldAliasProperty" }, @@ -42237,6 +42240,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 5c512d4d5f..d4aac5966f 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -53822,6 +53822,9 @@ { "name": "constant_keyword" }, + { + "name": "counted_keyword" + }, { "name": "aggregate_metric_double" }, @@ -53845,7 +53848,7 @@ "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L168-L216" + "specLocation": "_types/mapping/Property.ts#L170-L219" }, { "kind": "enum", @@ -87585,7 +87588,7 @@ "name": "Property", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L97-L166", + "specLocation": "_types/mapping/Property.ts#L98-L168", "type": { "items": [ { @@ -87763,6 +87766,13 @@ "namespace": "_types.mapping" } }, + { + "kind": "instance_of", + "type": { + "name": "CountedKeywordProperty", + "namespace": "_types.mapping" + } + }, { "kind": "instance_of", "type": { @@ -88136,7 +88146,7 @@ } } ], - "specLocation": "_types/mapping/Property.ts#L85-L95" + "specLocation": "_types/mapping/Property.ts#L86-L96" }, { "inherits": { @@ -90445,6 +90455,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": { @@ -90478,7 +90523,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L55-L58" + "specLocation": "_types/mapping/specialized.ts#L64-L67" }, { "inherits": { @@ -90513,7 +90558,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L60-L63" + "specLocation": "_types/mapping/specialized.ts#L69-L72" }, { "inherits": { @@ -90623,7 +90668,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L65-L79" + "specLocation": "_types/mapping/specialized.ts#L74-L88" }, { "inherits": { @@ -90647,7 +90692,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L81-L83" + "specLocation": "_types/mapping/specialized.ts#L90-L92" }, { "inherits": { @@ -90726,7 +90771,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L85-L92" + "specLocation": "_types/mapping/specialized.ts#L94-L101" }, { "inherits": { @@ -91881,7 +91926,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 c8fb2d318f..963f31812a 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -75191,6 +75191,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": { @@ -76306,7 +76341,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L55-L58" + "specLocation": "_types/mapping/specialized.ts#L64-L67" }, { "kind": "interface", @@ -76498,6 +76533,9 @@ { "name": "constant_keyword" }, + { + "name": "counted_keyword" + }, { "name": "aggregate_metric_double" }, @@ -76521,7 +76559,7 @@ "name": "FieldType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/Property.ts#L168-L216" + "specLocation": "_types/mapping/Property.ts#L170-L219" }, { "kind": "interface", @@ -76987,7 +77025,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L60-L63" + "specLocation": "_types/mapping/specialized.ts#L69-L72" }, { "kind": "interface", @@ -77189,7 +77227,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L94-L118" + "specLocation": "_types/mapping/specialized.ts#L103-L127" }, { "kind": "interface", @@ -77401,7 +77439,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L65-L79" + "specLocation": "_types/mapping/specialized.ts#L74-L88" }, { "kind": "interface", @@ -77854,7 +77892,7 @@ } } ], - "specLocation": "_types/mapping/specialized.ts#L81-L83" + "specLocation": "_types/mapping/specialized.ts#L90-L92" }, { "kind": "interface", @@ -78242,7 +78280,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": [ @@ -78421,6 +78459,13 @@ "namespace": "_types.mapping" } }, + { + "kind": "instance_of", + "type": { + "name": "CountedKeywordProperty", + "namespace": "_types.mapping" + } + }, { "kind": "instance_of", "type": { @@ -78704,7 +78749,7 @@ } } ], - "specLocation": "_types/mapping/Property.ts#L85-L95" + "specLocation": "_types/mapping/Property.ts#L86-L96" }, { "kind": "interface", @@ -79993,7 +80038,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 fb0b7a7a95..3a3c37d637 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5406,6 +5406,11 @@ export interface MappingCorePropertyBase extends MappingPropertyBase { store?: boolean } +export interface MappingCountedKeywordProperty extends MappingPropertyBase { + type: 'counted_keyword' + index?: boolean +} + export interface MappingDataStreamTimestamp { enabled: boolean } @@ -5526,7 +5531,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 @@ -5721,7 +5726,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'