From 9fd43f8ed9ee91722e687d47e22199a1e3adf594 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Tue, 16 Jul 2024 18:10:35 +0200 Subject: [PATCH 1/4] making range aggregation untagged union --- compiler/src/steps/validate-model.ts | 1 + output/openapi/elasticsearch-openapi.json | 77 ++++++++ .../elasticsearch-serverless-openapi.json | 77 ++++++++ output/schema/schema-serverless.json | 178 ++++++++++++++--- output/schema/schema.json | 180 +++++++++++++++--- output/typescript/types.ts | 17 +- specification/_types/aggregations/bucket.ts | 21 +- 7 files changed, 486 insertions(+), 65 deletions(-) diff --git a/compiler/src/steps/validate-model.ts b/compiler/src/steps/validate-model.ts index 86e7530f81..6a46d09527 100644 --- a/compiler/src/steps/validate-model.ts +++ b/compiler/src/steps/validate-model.ts @@ -610,6 +610,7 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma } else if (variants.kind === 'untagged') { if (fqn(parentName) !== '_types.query_dsl:DecayFunction' && fqn(parentName) !== '_types.query_dsl:DistanceFeatureQuery' && + fqn(parentName) !== '_types.aggregations:AggregationRange' && fqn(parentName) !== '_types.query_dsl:RangeQuery') { throw new Error(`Please contact the devtools team before adding new untagged variant ${fqn(parentName)}`) } diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index a1b04ed1ff..26f1691e29 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -63778,6 +63778,56 @@ ] }, "_types.aggregations:AggregationRange": { + "oneOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:UntypedAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:StringAggregationRange" + } + ] + }, + "_types.aggregations:UntypedAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBase" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBase": { + "type": "object", + "properties": { + "from": { + "description": "Start of the range (inclusive).", + "type": "object" + }, + "key": { + "description": "Custom key to return the range with.", + "type": "string" + }, + "to": { + "description": "End of the range (exclusive).", + "type": "object" + } + } + }, + "_types.aggregations:NumberAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasedouble" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBasedouble": { "type": "object", "properties": { "from": { @@ -63794,6 +63844,33 @@ } } }, + "_types.aggregations:StringAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasestring" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBasestring": { + "type": "object", + "properties": { + "from": { + "description": "Start of the range (inclusive).", + "type": "string" + }, + "key": { + "description": "Custom key to return the range with.", + "type": "string" + }, + "to": { + "description": "End of the range (exclusive).", + "type": "string" + } + } + }, "_types.aggregations:GeoHashGridAggregation": { "allOf": [ { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index d67a07918c..3397fa0aa0 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -40414,6 +40414,56 @@ ] }, "_types.aggregations:AggregationRange": { + "oneOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:UntypedAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:StringAggregationRange" + } + ] + }, + "_types.aggregations:UntypedAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBase" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBase": { + "type": "object", + "properties": { + "from": { + "description": "Start of the range (inclusive).", + "type": "object" + }, + "key": { + "description": "Custom key to return the range with.", + "type": "string" + }, + "to": { + "description": "End of the range (exclusive).", + "type": "object" + } + } + }, + "_types.aggregations:NumberAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasedouble" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBasedouble": { "type": "object", "properties": { "from": { @@ -40430,6 +40480,33 @@ } } }, + "_types.aggregations:StringAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasestring" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBasestring": { + "type": "object", + "properties": { + "from": { + "description": "Start of the range (inclusive).", + "type": "string" + }, + "key": { + "description": "Custom key to return the range with.", + "type": "string" + }, + "to": { + "description": "End of the range (exclusive).", + "type": "string" + } + } + }, "_types.aggregations:GeoHashGridAggregation": { "allOf": [ { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 17a06964ac..bc6980e105 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -60529,7 +60529,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1045-L1109" + "specLocation": "_types/aggregations/bucket.ts#L1060-L1124" }, { "codegenNames": [ @@ -60541,7 +60541,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1111-L1114", + "specLocation": "_types/aggregations/bucket.ts#L1126-L1129", "type": { "items": [ { @@ -60609,7 +60609,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1116-L1120" + "specLocation": "_types/aggregations/bucket.ts#L1131-L1135" }, { "inherits": { @@ -61483,7 +61483,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L983-L985", + "specLocation": "_types/aggregations/bucket.ts#L998-L1000", "type": { "items": [ { @@ -61958,7 +61958,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1167-L1191" + "specLocation": "_types/aggregations/bucket.ts#L1182-L1206" }, { "kind": "interface", @@ -62003,7 +62003,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1153-L1165" + "specLocation": "_types/aggregations/bucket.ts#L1168-L1180" }, { "codegenNames": [ @@ -62015,7 +62015,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", + "specLocation": "_types/aggregations/bucket.ts#L1023-L1024", "type": { "items": [ { @@ -62050,7 +62050,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1005-L1006", + "specLocation": "_types/aggregations/bucket.ts#L1020-L1021", "type": { "items": [ { @@ -62113,7 +62113,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1011-L1020" + "specLocation": "_types/aggregations/bucket.ts#L1026-L1035" }, { "inherits": { @@ -62391,11 +62391,83 @@ "specLocation": "_types/aggregations/bucket.ts#L382-L405" }, { - "kind": "interface", + "codegenNames": [ + "untyped", + "number", + "string" + ], + "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, + "specLocation": "_types/aggregations/bucket.ts#L674-L681", + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" + } + }, + { + "kind": "instance_of", + "type": { + "name": "NumberAggregationRange", + "namespace": "_types.aggregations" + } + }, + { + "kind": "instance_of", + "type": { + "name": "StringAggregationRange", + "namespace": "_types.aggregations" + } + } + ], + "kind": "union_of" + }, + "variants": { + "kind": "untagged", + "untypedVariant": { + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" + } + } + }, + { + "inherits": { + "generics": [ + { + "kind": "user_defined_value" + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L702-L702" + }, + { + "generics": [ + { + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" + } + ], + "kind": "interface", + "name": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + }, "properties": [ { "description": "Start of the range (inclusive).", @@ -62404,8 +62476,8 @@ "type": { "kind": "instance_of", "type": { - "name": "double", - "namespace": "_types" + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" } } }, @@ -62426,15 +62498,63 @@ "name": "to", "required": false, "type": { + "kind": "instance_of", + "type": { + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" + } + } + } + ], + "specLocation": "_types/aggregations/bucket.ts#L683-L696" + }, + { + "inherits": { + "generics": [ + { "kind": "instance_of", "type": { "name": "double", "namespace": "_types" } } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" } - ], - "specLocation": "_types/aggregations/bucket.ts#L674-L687" + }, + "kind": "interface", + "name": { + "name": "NumberAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L698-L698" + }, + { + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "StringAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L700-L700" }, { "inherits": { @@ -63215,7 +63335,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1122-L1151" + "specLocation": "_types/aggregations/bucket.ts#L1137-L1166" }, { "inherits": { @@ -64286,7 +64406,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L987-L996" + "specLocation": "_types/aggregations/bucket.ts#L1002-L1011" }, { "kind": "interface", @@ -64852,7 +64972,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L689-L719" + "specLocation": "_types/aggregations/bucket.ts#L704-L734" }, { "inherits": { @@ -64939,7 +65059,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L721-L727" + "specLocation": "_types/aggregations/bucket.ts#L736-L742" }, { "inherits": { @@ -64968,7 +65088,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L729-L735" + "specLocation": "_types/aggregations/bucket.ts#L744-L750" }, { "inherits": { @@ -65276,7 +65396,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L772-L836" + "specLocation": "_types/aggregations/bucket.ts#L787-L851" }, { "kind": "interface", @@ -65310,7 +65430,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L737-L746" + "specLocation": "_types/aggregations/bucket.ts#L752-L761" }, { "kind": "enum", @@ -65332,7 +65452,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L998-L1003" + "specLocation": "_types/aggregations/bucket.ts#L1013-L1018" }, { "kind": "interface", @@ -65354,7 +65474,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L748-L753" + "specLocation": "_types/aggregations/bucket.ts#L763-L768" }, { "kind": "interface", @@ -65388,7 +65508,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L755-L764" + "specLocation": "_types/aggregations/bucket.ts#L770-L779" }, { "kind": "interface", @@ -65397,7 +65517,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L766-L766" + "specLocation": "_types/aggregations/bucket.ts#L781-L781" }, { "kind": "interface", @@ -65418,7 +65538,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L768-L770" + "specLocation": "_types/aggregations/bucket.ts#L783-L785" }, { "inherits": { @@ -65639,7 +65759,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L838-L910" + "specLocation": "_types/aggregations/bucket.ts#L853-L925" }, { "inherits": { @@ -65946,7 +66066,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L912-L977" + "specLocation": "_types/aggregations/bucket.ts#L927-L992" }, { "inherits": { @@ -66570,7 +66690,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1022-L1043" + "specLocation": "_types/aggregations/bucket.ts#L1037-L1058" }, { "kind": "interface", diff --git a/output/schema/schema.json b/output/schema/schema.json index e5eaf5d5ea..39bd7c7268 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -49738,7 +49738,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L983-L985", + "specLocation": "_types/aggregations/bucket.ts#L998-L1000", "type": { "items": [ { @@ -50927,11 +50927,63 @@ } }, { - "kind": "interface", + "codegenNames": [ + "untyped", + "number", + "string" + ], + "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, + "specLocation": "_types/aggregations/bucket.ts#L674-L681", + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" + } + }, + { + "kind": "instance_of", + "type": { + "name": "NumberAggregationRange", + "namespace": "_types.aggregations" + } + }, + { + "kind": "instance_of", + "type": { + "name": "StringAggregationRange", + "namespace": "_types.aggregations" + } + } + ], + "kind": "union_of" + }, + "variants": { + "kind": "untagged", + "untypedVariant": { + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" + } + } + }, + { + "generics": [ + { + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" + } + ], + "kind": "interface", + "name": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + }, "properties": [ { "description": "Start of the range (inclusive).", @@ -50940,8 +50992,8 @@ "type": { "kind": "instance_of", "type": { - "name": "double", - "namespace": "_types" + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" } } }, @@ -50964,13 +51016,13 @@ "type": { "kind": "instance_of", "type": { - "name": "double", - "namespace": "_types" + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" } } } ], - "specLocation": "_types/aggregations/bucket.ts#L674-L687" + "specLocation": "_types/aggregations/bucket.ts#L683-L696" }, { "kind": "interface", @@ -52241,7 +52293,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1045-L1109" + "specLocation": "_types/aggregations/bucket.ts#L1060-L1124" }, { "codegenNames": [ @@ -52253,7 +52305,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1111-L1114", + "specLocation": "_types/aggregations/bucket.ts#L1126-L1129", "type": { "items": [ { @@ -52306,7 +52358,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L737-L746" + "specLocation": "_types/aggregations/bucket.ts#L752-L761" }, { "attachedBehaviors": [ @@ -52921,7 +52973,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1116-L1120" + "specLocation": "_types/aggregations/bucket.ts#L1131-L1135" }, { "inherits": { @@ -54318,7 +54370,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1167-L1191" + "specLocation": "_types/aggregations/bucket.ts#L1182-L1206" }, { "attachedBehaviors": [ @@ -54418,7 +54470,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1153-L1165" + "specLocation": "_types/aggregations/bucket.ts#L1168-L1180" }, { "kind": "enum", @@ -55289,7 +55341,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L748-L753" + "specLocation": "_types/aggregations/bucket.ts#L763-L768" }, { "kind": "interface", @@ -56178,7 +56230,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1122-L1151" + "specLocation": "_types/aggregations/bucket.ts#L1137-L1166" }, { "attachedBehaviors": [ @@ -57784,7 +57836,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L755-L764" + "specLocation": "_types/aggregations/bucket.ts#L770-L779" }, { "attachedBehaviors": [ @@ -57896,6 +57948,30 @@ }, "specLocation": "_types/aggregations/pipeline.ts#L326-L352" }, + { + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "NumberAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L698-L698" + }, { "attachedBehaviors": [ "AdditionalProperties" @@ -57950,7 +58026,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L766-L766" + "specLocation": "_types/aggregations/bucket.ts#L781-L781" }, { "inherits": { @@ -58539,7 +58615,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L689-L719" + "specLocation": "_types/aggregations/bucket.ts#L704-L734" }, { "inherits": { @@ -58684,7 +58760,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L721-L727" + "specLocation": "_types/aggregations/bucket.ts#L736-L742" }, { "attachedBehaviors": [ @@ -58732,7 +58808,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L729-L735" + "specLocation": "_types/aggregations/bucket.ts#L744-L750" }, { "kind": "enum", @@ -58775,7 +58851,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L768-L770" + "specLocation": "_types/aggregations/bucket.ts#L783-L785" }, { "inherits": { @@ -59281,7 +59357,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L772-L836" + "specLocation": "_types/aggregations/bucket.ts#L787-L851" }, { "attachedBehaviors": [ @@ -59543,7 +59619,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L838-L910" + "specLocation": "_types/aggregations/bucket.ts#L853-L925" }, { "inherits": { @@ -60129,6 +60205,30 @@ "properties": [], "specLocation": "_types/aggregations/pipeline.ts#L369-L369" }, + { + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "StringAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L700-L700" + }, { "description": "Result of the `rare_terms` aggregation when the field is a string.", "inherits": { @@ -60953,7 +61053,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L912-L977" + "specLocation": "_types/aggregations/bucket.ts#L927-L992" }, { "kind": "enum", @@ -60971,7 +61071,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L987-L996" + "specLocation": "_types/aggregations/bucket.ts#L1002-L1011" }, { "kind": "enum", @@ -60993,7 +61093,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L998-L1003" + "specLocation": "_types/aggregations/bucket.ts#L1013-L1018" }, { "attachedBehaviors": [ @@ -61035,7 +61135,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", + "specLocation": "_types/aggregations/bucket.ts#L1023-L1024", "type": { "items": [ { @@ -61070,7 +61170,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1005-L1006", + "specLocation": "_types/aggregations/bucket.ts#L1020-L1021", "type": { "items": [ { @@ -61133,7 +61233,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1011-L1020" + "specLocation": "_types/aggregations/bucket.ts#L1026-L1035" }, { "kind": "interface", @@ -61695,6 +61795,26 @@ "specLocation": "_types/aggregations/Aggregate.ts#L425-L431", "variantName": "umterms" }, + { + "inherits": { + "generics": [ + { + "kind": "user_defined_value" + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L702-L702" + }, { "description": "Value count aggregation result. `value` is always present.", "inherits": { @@ -61860,7 +61980,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1022-L1043" + "specLocation": "_types/aggregations/bucket.ts#L1037-L1058" }, { "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 1a0bb06f1d..831763a458 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2988,10 +2988,12 @@ export interface AggregationsAggregationContainer { variable_width_histogram?: AggregationsVariableWidthHistogramAggregation } -export interface AggregationsAggregationRange { - from?: double +export type AggregationsAggregationRange = AggregationsUntypedAggregationRange | AggregationsNumberAggregationRange | AggregationsStringAggregationRange + +export interface AggregationsAggregationRangeBase { + from?: T key?: string - to?: double + to?: T } export interface AggregationsArrayPercentilesItem { @@ -3811,6 +3813,9 @@ export interface AggregationsNormalizeAggregation extends AggregationsPipelineAg export type AggregationsNormalizeMethod = 'rescale_0_1' | 'rescale_0_100' | 'percent_of_sum' | 'mean' | 'z-score' | 'softmax' +export interface AggregationsNumberAggregationRange extends AggregationsAggregationRangeBase { +} + export interface AggregationsParentAggregateKeys extends AggregationsSingleBucketAggregateBase { } export type AggregationsParentAggregate = AggregationsParentAggregateKeys @@ -4063,6 +4068,9 @@ export interface AggregationsStatsBucketAggregate extends AggregationsStatsAggre export interface AggregationsStatsBucketAggregation extends AggregationsPipelineAggregationBase { } +export interface AggregationsStringAggregationRange extends AggregationsAggregationRangeBase { +} + export interface AggregationsStringRareTermsAggregate extends AggregationsMultiBucketAggregateBase { } @@ -4230,6 +4238,9 @@ export interface AggregationsUnmappedSignificantTermsAggregate extends Aggregati export interface AggregationsUnmappedTermsAggregate extends AggregationsTermsAggregateBase { } +export interface AggregationsUntypedAggregationRange extends AggregationsAggregationRangeBase { +} + export interface AggregationsValueCountAggregate extends AggregationsSingleMetricAggregateBase { } diff --git a/specification/_types/aggregations/bucket.ts b/specification/_types/aggregations/bucket.ts index c3343f096a..7acd0821ad 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -671,11 +671,20 @@ export class RangeAggregation extends BucketAggregationBase { format?: string } -export class AggregationRange { +/** + * @codegen_names untyped, number, string + * @variants untagged untyped=_types.aggregations.UntypedAggregationRange + */ +export type AggregationRange = + | UntypedAggregationRange + | NumberAggregationRange + | StringAggregationRange + +export class AggregationRangeBase { /** * Start of the range (inclusive). */ - from?: double + from?: T /** * Custom key to return the range with. */ @@ -683,9 +692,15 @@ export class AggregationRange { /** * End of the range (exclusive). */ - to?: double + to?: T } +export class NumberAggregationRange extends AggregationRangeBase {} + +export class StringAggregationRange extends AggregationRangeBase {} + +export class UntypedAggregationRange extends AggregationRangeBase {} + export class RareTermsAggregation extends BucketAggregationBase { /** * Terms that should be excluded from the aggregation. From 07886ab3f22e013b42f0358e63824fe5c89949d3 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Wed, 17 Jul 2024 10:52:37 +0200 Subject: [PATCH 2/4] same as range query --- compiler/src/steps/validate-model.ts | 4 +- output/openapi/elasticsearch-openapi.json | 21 +- .../elasticsearch-serverless-openapi.json | 21 +- output/schema/schema-serverless.json | 296 +++++++++--------- output/schema/schema.json | 226 +++++++------ output/typescript/types.ts | 19 +- specification/_types/aggregations/bucket.ts | 44 +-- 7 files changed, 307 insertions(+), 324 deletions(-) diff --git a/compiler/src/steps/validate-model.ts b/compiler/src/steps/validate-model.ts index 6a46d09527..484e5e8c0c 100644 --- a/compiler/src/steps/validate-model.ts +++ b/compiler/src/steps/validate-model.ts @@ -608,9 +608,9 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma validateValueOf(valueOf, new Set()) } else if (variants.kind === 'untagged') { - if (fqn(parentName) !== '_types.query_dsl:DecayFunction' && + if (fqn(parentName) !== '_types.aggregations:AggregationRange' && + fqn(parentName) !== '_types.query_dsl:DecayFunction' && fqn(parentName) !== '_types.query_dsl:DistanceFeatureQuery' && - fqn(parentName) !== '_types.aggregations:AggregationRange' && fqn(parentName) !== '_types.query_dsl:RangeQuery') { throw new Error(`Please contact the devtools team before adding new untagged variant ${fqn(parentName)}`) } diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 26f1691e29..cb42c6037f 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -63467,7 +63467,7 @@ "description": "Array of date ranges.", "type": "array", "items": { - "$ref": "#/components/schemas/_types.aggregations:DateRangeExpression" + "$ref": "#/components/schemas/_types.aggregations:DateAggregationRange" } }, "time_zone": { @@ -63481,7 +63481,17 @@ } ] }, - "_types.aggregations:DateRangeExpression": { + "_types.aggregations:DateAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBaseFieldDateMath" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBaseFieldDateMath": { "type": "object", "properties": { "from": { @@ -63782,11 +63792,14 @@ { "$ref": "#/components/schemas/_types.aggregations:UntypedAggregationRange" }, + { + "$ref": "#/components/schemas/_types.aggregations:DateAggregationRange" + }, { "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" }, { - "$ref": "#/components/schemas/_types.aggregations:StringAggregationRange" + "$ref": "#/components/schemas/_types.aggregations:TermAggregationRange" } ] }, @@ -63844,7 +63857,7 @@ } } }, - "_types.aggregations:StringAggregationRange": { + "_types.aggregations:TermAggregationRange": { "allOf": [ { "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasestring" diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 3397fa0aa0..684679af8d 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -40103,7 +40103,7 @@ "description": "Array of date ranges.", "type": "array", "items": { - "$ref": "#/components/schemas/_types.aggregations:DateRangeExpression" + "$ref": "#/components/schemas/_types.aggregations:DateAggregationRange" } }, "time_zone": { @@ -40117,7 +40117,17 @@ } ] }, - "_types.aggregations:DateRangeExpression": { + "_types.aggregations:DateAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBaseFieldDateMath" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBaseFieldDateMath": { "type": "object", "properties": { "from": { @@ -40418,11 +40428,14 @@ { "$ref": "#/components/schemas/_types.aggregations:UntypedAggregationRange" }, + { + "$ref": "#/components/schemas/_types.aggregations:DateAggregationRange" + }, { "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" }, { - "$ref": "#/components/schemas/_types.aggregations:StringAggregationRange" + "$ref": "#/components/schemas/_types.aggregations:TermAggregationRange" } ] }, @@ -40480,7 +40493,7 @@ } } }, - "_types.aggregations:StringAggregationRange": { + "_types.aggregations:TermAggregationRange": { "allOf": [ { "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasestring" diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index bc6980e105..dd44f79a3e 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -60529,7 +60529,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1060-L1124" + "specLocation": "_types/aggregations/bucket.ts#L1048-L1112" }, { "codegenNames": [ @@ -60541,7 +60541,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1126-L1129", + "specLocation": "_types/aggregations/bucket.ts#L1114-L1117", "type": { "items": [ { @@ -60609,7 +60609,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1131-L1135" + "specLocation": "_types/aggregations/bucket.ts#L1119-L1123" }, { "inherits": { @@ -61475,7 +61475,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L491-L500" + "specLocation": "_types/aggregations/bucket.ts#L467-L476" }, { "kind": "type_alias", @@ -61483,7 +61483,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L998-L1000", + "specLocation": "_types/aggregations/bucket.ts#L986-L988", "type": { "items": [ { @@ -61587,7 +61587,7 @@ "value": { "kind": "instance_of", "type": { - "name": "DateRangeExpression", + "name": "DateAggregationRange", "namespace": "_types.aggregations" } } @@ -61621,9 +61621,39 @@ "specLocation": "_types/aggregations/bucket.ts#L270-L296" }, { + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "FieldDateMath", + "namespace": "_types.aggregations" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, "kind": "interface", "name": { - "name": "DateRangeExpression", + "name": "DateAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L681-L681" + }, + { + "generics": [ + { + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" + } + ], + "kind": "interface", + "name": { + "name": "AggregationRangeBase", "namespace": "_types.aggregations" }, "properties": [ @@ -61634,8 +61664,8 @@ "type": { "kind": "instance_of", "type": { - "name": "FieldDateMath", - "namespace": "_types.aggregations" + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" } } }, @@ -61658,60 +61688,13 @@ "type": { "kind": "instance_of", "type": { - "name": "FieldDateMath", - "namespace": "_types.aggregations" + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" } } } ], - "specLocation": "_types/aggregations/bucket.ts#L307-L320" - }, - { - "codegenNames": [ - "expr", - "value" - ], - "description": "A date range limit, represented either as a DateMath expression or a number expressed\naccording to the target field's precision.", - "kind": "type_alias", - "name": { - "name": "FieldDateMath", - "namespace": "_types.aggregations" - }, - "specLocation": "_types/aggregations/bucket.ts#L298-L305", - "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "DateMath", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - } - ], - "kind": "union_of" - } - }, - { - "kind": "type_alias", - "name": { - "name": "DateMath", - "namespace": "_types" - }, - "specLocation": "_types/Time.ts#L42-L42", - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } + "specLocation": "_types/aggregations/bucket.ts#L660-L673" }, { "inherits": { @@ -61804,7 +61787,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L322-L343" + "specLocation": "_types/aggregations/bucket.ts#L298-L319" }, { "kind": "enum", @@ -61826,7 +61809,7 @@ "name": "SamplerAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L345-L358" + "specLocation": "_types/aggregations/bucket.ts#L321-L334" }, { "inherits": { @@ -61958,7 +61941,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1182-L1206" + "specLocation": "_types/aggregations/bucket.ts#L1170-L1194" }, { "kind": "interface", @@ -62003,7 +61986,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1168-L1180" + "specLocation": "_types/aggregations/bucket.ts#L1156-L1168" }, { "codegenNames": [ @@ -62015,7 +61998,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1023-L1024", + "specLocation": "_types/aggregations/bucket.ts#L1011-L1012", "type": { "items": [ { @@ -62050,7 +62033,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1020-L1021", + "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", "type": { "items": [ { @@ -62113,7 +62096,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1026-L1035" + "specLocation": "_types/aggregations/bucket.ts#L1014-L1023" }, { "inherits": { @@ -62188,7 +62171,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L360-L380" + "specLocation": "_types/aggregations/bucket.ts#L336-L356" }, { "codegenNames": [ @@ -62388,20 +62371,21 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L382-L405" + "specLocation": "_types/aggregations/bucket.ts#L358-L381" }, { "codegenNames": [ "untyped", + "date", "number", - "string" + "term" ], "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L674-L681", + "specLocation": "_types/aggregations/bucket.ts#L650-L658", "type": { "items": [ { @@ -62411,6 +62395,13 @@ "namespace": "_types.aggregations" } }, + { + "kind": "instance_of", + "type": { + "name": "DateAggregationRange", + "namespace": "_types.aggregations" + } + }, { "kind": "instance_of", "type": { @@ -62421,7 +62412,7 @@ { "kind": "instance_of", "type": { - "name": "StringAggregationRange", + "name": "TermAggregationRange", "namespace": "_types.aggregations" } } @@ -62454,59 +62445,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L702-L702" - }, - { - "generics": [ - { - "name": "T", - "namespace": "_types.aggregations.AggregationRangeBase" - } - ], - "kind": "interface", - "name": { - "name": "AggregationRangeBase", - "namespace": "_types.aggregations" - }, - "properties": [ - { - "description": "Start of the range (inclusive).", - "name": "from", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "T", - "namespace": "_types.aggregations.AggregationRangeBase" - } - } - }, - { - "description": "Custom key to return the range with.", - "name": "key", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "description": "End of the range (exclusive).", - "name": "to", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "T", - "namespace": "_types.aggregations.AggregationRangeBase" - } - } - } - ], - "specLocation": "_types/aggregations/bucket.ts#L683-L696" + "specLocation": "_types/aggregations/bucket.ts#L679-L679" }, { "inherits": { @@ -62530,7 +62469,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L698-L698" + "specLocation": "_types/aggregations/bucket.ts#L675-L675" }, { "inherits": { @@ -62550,11 +62489,11 @@ }, "kind": "interface", "name": { - "name": "StringAggregationRange", + "name": "TermAggregationRange", "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L700-L700" + "specLocation": "_types/aggregations/bucket.ts#L677-L677" }, { "inherits": { @@ -62632,7 +62571,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L407-L432" + "specLocation": "_types/aggregations/bucket.ts#L383-L408" }, { "codegenNames": [ @@ -62858,7 +62797,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L434-L460" + "specLocation": "_types/aggregations/bucket.ts#L410-L436" }, { "kind": "type_alias", @@ -62951,7 +62890,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L462-L487" + "specLocation": "_types/aggregations/bucket.ts#L438-L463" }, { "inherits": { @@ -62966,7 +62905,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L489-L489" + "specLocation": "_types/aggregations/bucket.ts#L465-L465" }, { "inherits": { @@ -63131,7 +63070,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L502-L548" + "specLocation": "_types/aggregations/bucket.ts#L478-L524" }, { "inherits": { @@ -63174,7 +63113,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L550-L559" + "specLocation": "_types/aggregations/bucket.ts#L526-L535" }, { "kind": "interface", @@ -63244,7 +63183,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L561-L574" + "specLocation": "_types/aggregations/bucket.ts#L537-L550" }, { "inherits": { @@ -63335,7 +63274,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1137-L1166" + "specLocation": "_types/aggregations/bucket.ts#L1125-L1154" }, { "inherits": { @@ -63730,7 +63669,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L576-L582" + "specLocation": "_types/aggregations/bucket.ts#L552-L558" }, { "kind": "type_alias", @@ -64388,7 +64327,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L584-L624" + "specLocation": "_types/aggregations/bucket.ts#L560-L600" }, { "kind": "enum", @@ -64406,7 +64345,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1002-L1011" + "specLocation": "_types/aggregations/bucket.ts#L990-L999" }, { "kind": "interface", @@ -64440,7 +64379,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L626-L636" + "specLocation": "_types/aggregations/bucket.ts#L602-L612" }, { "inherits": { @@ -64468,7 +64407,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L638-L643" + "specLocation": "_types/aggregations/bucket.ts#L614-L619" }, { "inherits": { @@ -64559,7 +64498,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L645-L650" + "specLocation": "_types/aggregations/bucket.ts#L621-L626" }, { "inherits": { @@ -64871,7 +64810,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L652-L672" + "specLocation": "_types/aggregations/bucket.ts#L628-L648" }, { "inherits": { @@ -64972,7 +64911,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L704-L734" + "specLocation": "_types/aggregations/bucket.ts#L692-L722" }, { "inherits": { @@ -65059,7 +64998,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L736-L742" + "specLocation": "_types/aggregations/bucket.ts#L724-L730" }, { "inherits": { @@ -65088,7 +65027,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L744-L750" + "specLocation": "_types/aggregations/bucket.ts#L732-L738" }, { "inherits": { @@ -65396,7 +65335,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L787-L851" + "specLocation": "_types/aggregations/bucket.ts#L775-L839" }, { "kind": "interface", @@ -65430,7 +65369,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L752-L761" + "specLocation": "_types/aggregations/bucket.ts#L740-L749" }, { "kind": "enum", @@ -65452,7 +65391,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1013-L1018" + "specLocation": "_types/aggregations/bucket.ts#L1001-L1006" }, { "kind": "interface", @@ -65474,7 +65413,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L763-L768" + "specLocation": "_types/aggregations/bucket.ts#L751-L756" }, { "kind": "interface", @@ -65508,7 +65447,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L770-L779" + "specLocation": "_types/aggregations/bucket.ts#L758-L767" }, { "kind": "interface", @@ -65517,7 +65456,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L781-L781" + "specLocation": "_types/aggregations/bucket.ts#L769-L769" }, { "kind": "interface", @@ -65538,7 +65477,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L783-L785" + "specLocation": "_types/aggregations/bucket.ts#L771-L773" }, { "inherits": { @@ -65759,7 +65698,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L853-L925" + "specLocation": "_types/aggregations/bucket.ts#L841-L913" }, { "inherits": { @@ -66066,7 +66005,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L927-L992" + "specLocation": "_types/aggregations/bucket.ts#L915-L980" }, { "inherits": { @@ -66690,7 +66629,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1037-L1058" + "specLocation": "_types/aggregations/bucket.ts#L1025-L1046" }, { "kind": "interface", @@ -76361,6 +76300,21 @@ "kind": "union_of" } }, + { + "kind": "type_alias", + "name": { + "name": "DateMath", + "namespace": "_types" + }, + "specLocation": "_types/Time.ts#L42-L42", + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, { "kind": "type_alias", "name": { @@ -77494,6 +77448,38 @@ } } }, + { + "codegenNames": [ + "expr", + "value" + ], + "description": "A date range limit, represented either as a DateMath expression or a number expressed\naccording to the target field's precision.", + "kind": "type_alias", + "name": { + "name": "FieldDateMath", + "namespace": "_types.aggregations" + }, + "specLocation": "_types/aggregations/bucket.ts#L683-L690", + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "DateMath", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + ], + "kind": "union_of" + } + }, { "codegenNames": [ "name", diff --git a/output/schema/schema.json b/output/schema/schema.json index 39bd7c7268..cbd94e2063 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -49738,7 +49738,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L998-L1000", + "specLocation": "_types/aggregations/bucket.ts#L986-L988", "type": { "items": [ { @@ -50929,15 +50929,16 @@ { "codegenNames": [ "untyped", + "date", "number", - "string" + "term" ], "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L674-L681", + "specLocation": "_types/aggregations/bucket.ts#L650-L658", "type": { "items": [ { @@ -50947,6 +50948,13 @@ "namespace": "_types.aggregations" } }, + { + "kind": "instance_of", + "type": { + "name": "DateAggregationRange", + "namespace": "_types.aggregations" + } + }, { "kind": "instance_of", "type": { @@ -50957,7 +50965,7 @@ { "kind": "instance_of", "type": { - "name": "StringAggregationRange", + "name": "TermAggregationRange", "namespace": "_types.aggregations" } } @@ -51022,7 +51030,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L683-L696" + "specLocation": "_types/aggregations/bucket.ts#L660-L673" }, { "kind": "interface", @@ -52293,7 +52301,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1060-L1124" + "specLocation": "_types/aggregations/bucket.ts#L1048-L1112" }, { "codegenNames": [ @@ -52305,7 +52313,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1126-L1129", + "specLocation": "_types/aggregations/bucket.ts#L1114-L1117", "type": { "items": [ { @@ -52358,7 +52366,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L752-L761" + "specLocation": "_types/aggregations/bucket.ts#L740-L749" }, { "attachedBehaviors": [ @@ -52973,7 +52981,31 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1131-L1135" + "specLocation": "_types/aggregations/bucket.ts#L1119-L1123" + }, + { + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "FieldDateMath", + "namespace": "_types.aggregations" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "DateAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L681-L681" }, { "inherits": { @@ -53347,7 +53379,7 @@ "value": { "kind": "instance_of", "type": { - "name": "DateRangeExpression", + "name": "DateAggregationRange", "namespace": "_types.aggregations" } } @@ -53380,52 +53412,6 @@ ], "specLocation": "_types/aggregations/bucket.ts#L270-L296" }, - { - "kind": "interface", - "name": { - "name": "DateRangeExpression", - "namespace": "_types.aggregations" - }, - "properties": [ - { - "description": "Start of the range (inclusive).", - "name": "from", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "FieldDateMath", - "namespace": "_types.aggregations" - } - } - }, - { - "description": "Custom key to return the range with.", - "name": "key", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "description": "End of the range (exclusive).", - "name": "to", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "FieldDateMath", - "namespace": "_types.aggregations" - } - } - } - ], - "specLocation": "_types/aggregations/bucket.ts#L307-L320" - }, { "inherits": { "type": { @@ -53556,7 +53542,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L322-L343" + "specLocation": "_types/aggregations/bucket.ts#L298-L319" }, { "description": "Result of a `terms` aggregation when the field is some kind of decimal number like a float, double, or distance.", @@ -53719,7 +53705,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L491-L500" + "specLocation": "_types/aggregations/bucket.ts#L467-L476" }, { "inherits": { @@ -54059,7 +54045,7 @@ "name": "FieldDateMath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L298-L305", + "specLocation": "_types/aggregations/bucket.ts#L683-L690", "type": { "items": [ { @@ -54197,7 +54183,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L360-L380" + "specLocation": "_types/aggregations/bucket.ts#L336-L356" }, { "attachedBehaviors": [ @@ -54370,7 +54356,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1182-L1206" + "specLocation": "_types/aggregations/bucket.ts#L1170-L1194" }, { "attachedBehaviors": [ @@ -54470,7 +54456,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1168-L1180" + "specLocation": "_types/aggregations/bucket.ts#L1156-L1168" }, { "kind": "enum", @@ -54724,7 +54710,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L382-L405" + "specLocation": "_types/aggregations/bucket.ts#L358-L381" }, { "inherits": { @@ -54827,7 +54813,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L407-L432" + "specLocation": "_types/aggregations/bucket.ts#L383-L408" }, { "attachedBehaviors": [ @@ -55177,7 +55163,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L434-L460" + "specLocation": "_types/aggregations/bucket.ts#L410-L436" }, { "attachedBehaviors": [ @@ -55285,7 +55271,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L462-L487" + "specLocation": "_types/aggregations/bucket.ts#L438-L463" }, { "attachedBehaviors": [ @@ -55319,7 +55305,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L489-L489" + "specLocation": "_types/aggregations/bucket.ts#L465-L465" }, { "kind": "interface", @@ -55341,7 +55327,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L763-L768" + "specLocation": "_types/aggregations/bucket.ts#L751-L756" }, { "kind": "interface", @@ -55585,7 +55571,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L502-L548" + "specLocation": "_types/aggregations/bucket.ts#L478-L524" }, { "attachedBehaviors": [ @@ -56230,7 +56216,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1137-L1166" + "specLocation": "_types/aggregations/bucket.ts#L1125-L1154" }, { "attachedBehaviors": [ @@ -56361,7 +56347,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L550-L559" + "specLocation": "_types/aggregations/bucket.ts#L526-L535" }, { "kind": "interface", @@ -56431,7 +56417,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L561-L574" + "specLocation": "_types/aggregations/bucket.ts#L537-L550" }, { "attachedBehaviors": [ @@ -57248,7 +57234,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L576-L582" + "specLocation": "_types/aggregations/bucket.ts#L552-L558" }, { "kind": "enum", @@ -57602,7 +57588,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L626-L636" + "specLocation": "_types/aggregations/bucket.ts#L602-L612" }, { "inherits": { @@ -57747,7 +57733,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L584-L624" + "specLocation": "_types/aggregations/bucket.ts#L560-L600" }, { "attachedBehaviors": [ @@ -57836,7 +57822,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L770-L779" + "specLocation": "_types/aggregations/bucket.ts#L758-L767" }, { "attachedBehaviors": [ @@ -57883,7 +57869,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L638-L643" + "specLocation": "_types/aggregations/bucket.ts#L614-L619" }, { "inherits": { @@ -57970,7 +57956,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L698-L698" + "specLocation": "_types/aggregations/bucket.ts#L675-L675" }, { "attachedBehaviors": [ @@ -58017,7 +58003,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L645-L650" + "specLocation": "_types/aggregations/bucket.ts#L621-L626" }, { "kind": "interface", @@ -58026,7 +58012,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L781-L781" + "specLocation": "_types/aggregations/bucket.ts#L769-L769" }, { "inherits": { @@ -58439,7 +58425,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L652-L672" + "specLocation": "_types/aggregations/bucket.ts#L628-L648" }, { "attachedBehaviors": [ @@ -58615,7 +58601,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L704-L734" + "specLocation": "_types/aggregations/bucket.ts#L692-L722" }, { "inherits": { @@ -58760,7 +58746,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L736-L742" + "specLocation": "_types/aggregations/bucket.ts#L724-L730" }, { "attachedBehaviors": [ @@ -58808,7 +58794,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L744-L750" + "specLocation": "_types/aggregations/bucket.ts#L732-L738" }, { "kind": "enum", @@ -58830,7 +58816,7 @@ "name": "SamplerAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L345-L358" + "specLocation": "_types/aggregations/bucket.ts#L321-L334" }, { "kind": "interface", @@ -58851,7 +58837,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L783-L785" + "specLocation": "_types/aggregations/bucket.ts#L771-L773" }, { "inherits": { @@ -59357,7 +59343,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L787-L851" + "specLocation": "_types/aggregations/bucket.ts#L775-L839" }, { "attachedBehaviors": [ @@ -59619,7 +59605,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L853-L925" + "specLocation": "_types/aggregations/bucket.ts#L841-L913" }, { "inherits": { @@ -60205,30 +60191,6 @@ "properties": [], "specLocation": "_types/aggregations/pipeline.ts#L369-L369" }, - { - "inherits": { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - ], - "type": { - "name": "AggregationRangeBase", - "namespace": "_types.aggregations" - } - }, - "kind": "interface", - "name": { - "name": "StringAggregationRange", - "namespace": "_types.aggregations" - }, - "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L700-L700" - }, { "description": "Result of the `rare_terms` aggregation when the field is a string.", "inherits": { @@ -60784,6 +60746,30 @@ }, "specLocation": "_types/aggregations/metric.ts#L322-L335" }, + { + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "TermAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L677-L677" + }, { "generics": [ { @@ -61053,7 +61039,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L927-L992" + "specLocation": "_types/aggregations/bucket.ts#L915-L980" }, { "kind": "enum", @@ -61071,7 +61057,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1002-L1011" + "specLocation": "_types/aggregations/bucket.ts#L990-L999" }, { "kind": "enum", @@ -61093,7 +61079,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1013-L1018" + "specLocation": "_types/aggregations/bucket.ts#L1001-L1006" }, { "attachedBehaviors": [ @@ -61135,7 +61121,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1023-L1024", + "specLocation": "_types/aggregations/bucket.ts#L1011-L1012", "type": { "items": [ { @@ -61170,7 +61156,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1020-L1021", + "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", "type": { "items": [ { @@ -61233,7 +61219,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1026-L1035" + "specLocation": "_types/aggregations/bucket.ts#L1014-L1023" }, { "kind": "interface", @@ -61813,7 +61799,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L702-L702" + "specLocation": "_types/aggregations/bucket.ts#L679-L679" }, { "description": "Value count aggregation result. `value` is always present.", @@ -61980,7 +61966,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1037-L1058" + "specLocation": "_types/aggregations/bucket.ts#L1025-L1046" }, { "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 831763a458..457f85c6a4 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2988,7 +2988,7 @@ export interface AggregationsAggregationContainer { variable_width_histogram?: AggregationsVariableWidthHistogramAggregation } -export type AggregationsAggregationRange = AggregationsUntypedAggregationRange | AggregationsNumberAggregationRange | AggregationsStringAggregationRange +export type AggregationsAggregationRange = AggregationsUntypedAggregationRange | AggregationsDateAggregationRange | AggregationsNumberAggregationRange | AggregationsTermAggregationRange export interface AggregationsAggregationRangeBase { from?: T @@ -3216,6 +3216,9 @@ export interface AggregationsCustomCategorizeTextAnalyzer { filter?: string[] } +export interface AggregationsDateAggregationRange extends AggregationsAggregationRangeBase { +} + export interface AggregationsDateHistogramAggregate extends AggregationsMultiBucketAggregateBase { } @@ -3251,17 +3254,11 @@ export interface AggregationsDateRangeAggregation extends AggregationsBucketAggr field?: Field format?: string missing?: AggregationsMissing - ranges?: AggregationsDateRangeExpression[] + ranges?: AggregationsDateAggregationRange[] time_zone?: TimeZone keyed?: boolean } -export interface AggregationsDateRangeExpression { - from?: AggregationsFieldDateMath - key?: string - to?: AggregationsFieldDateMath -} - export interface AggregationsDerivativeAggregate extends AggregationsSingleMetricAggregateBase { normalized_value?: double normalized_value_as_string?: string @@ -4068,9 +4065,6 @@ export interface AggregationsStatsBucketAggregate extends AggregationsStatsAggre export interface AggregationsStatsBucketAggregation extends AggregationsPipelineAggregationBase { } -export interface AggregationsStringAggregationRange extends AggregationsAggregationRangeBase { -} - export interface AggregationsStringRareTermsAggregate extends AggregationsMultiBucketAggregateBase { } @@ -4137,6 +4131,9 @@ export interface AggregationsTTestAggregation { export type AggregationsTTestType = 'paired' | 'homoscedastic' | 'heteroscedastic' +export interface AggregationsTermAggregationRange extends AggregationsAggregationRangeBase { +} + export interface AggregationsTermsAggregateBase extends AggregationsMultiBucketAggregateBase { doc_count_error_upper_bound?: long sum_other_doc_count?: long diff --git a/specification/_types/aggregations/bucket.ts b/specification/_types/aggregations/bucket.ts index 7acd0821ad..6e11d90e8e 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -284,7 +284,7 @@ export class DateRangeAggregation extends BucketAggregationBase { /** * Array of date ranges. */ - ranges?: DateRangeExpression[] + ranges?: DateAggregationRange[] /** * Time zone used to convert dates from another time zone to UTC. */ @@ -295,30 +295,6 @@ export class DateRangeAggregation extends BucketAggregationBase { keyed?: boolean } -/** - * A date range limit, represented either as a DateMath expression or a number expressed - * according to the target field's precision. - * - * @codegen_names expr, value - */ -// ES: DateRangeAggregationBuilder.innerBuild() -export type FieldDateMath = DateMath | double - -export class DateRangeExpression { - /** - * Start of the range (inclusive). - */ - from?: FieldDateMath - /** - * Custom key to return the range with. - */ - key?: string - /** - * End of the range (exclusive). - */ - to?: FieldDateMath -} - export class DiversifiedSamplerAggregation extends BucketAggregationBase { /** * The type of value used for de-duplication. @@ -672,13 +648,14 @@ export class RangeAggregation extends BucketAggregationBase { } /** - * @codegen_names untyped, number, string + * @codegen_names untyped, date, number, term * @variants untagged untyped=_types.aggregations.UntypedAggregationRange */ export type AggregationRange = | UntypedAggregationRange + | DateAggregationRange | NumberAggregationRange - | StringAggregationRange + | TermAggregationRange export class AggregationRangeBase { /** @@ -697,10 +674,21 @@ export class AggregationRangeBase { export class NumberAggregationRange extends AggregationRangeBase {} -export class StringAggregationRange extends AggregationRangeBase {} +export class TermAggregationRange extends AggregationRangeBase {} export class UntypedAggregationRange extends AggregationRangeBase {} +export class DateAggregationRange extends AggregationRangeBase {} + +/** + * A date range limit, represented either as a DateMath expression or a number expressed + * according to the target field's precision. + * + * @codegen_names expr, value + */ +// ES: DateRangeAggregationBuilder.innerBuild() +export type FieldDateMath = DateMath | double + export class RareTermsAggregation extends BucketAggregationBase { /** * Terms that should be excluded from the aggregation. From 1f832eff515668b607e0d3e4c97cbce48439c11a Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Thu, 18 Jul 2024 16:41:38 +0200 Subject: [PATCH 3/4] removed term range aggregation --- output/openapi/elasticsearch-openapi.json | 30 ------ .../elasticsearch-serverless-openapi.json | 30 ------ output/schema/schema-serverless.json | 94 ++++++------------- output/schema/schema.json | 94 ++++++------------- output/typescript/types.ts | 5 +- specification/_types/aggregations/bucket.ts | 6 +- 6 files changed, 64 insertions(+), 195 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index cb42c6037f..dce1ae3aab 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -63797,9 +63797,6 @@ }, { "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" - }, - { - "$ref": "#/components/schemas/_types.aggregations:TermAggregationRange" } ] }, @@ -63857,33 +63854,6 @@ } } }, - "_types.aggregations:TermAggregationRange": { - "allOf": [ - { - "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasestring" - }, - { - "type": "object" - } - ] - }, - "_types.aggregations:AggregationRangeBasestring": { - "type": "object", - "properties": { - "from": { - "description": "Start of the range (inclusive).", - "type": "string" - }, - "key": { - "description": "Custom key to return the range with.", - "type": "string" - }, - "to": { - "description": "End of the range (exclusive).", - "type": "string" - } - } - }, "_types.aggregations:GeoHashGridAggregation": { "allOf": [ { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 684679af8d..86329f10ea 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -40433,9 +40433,6 @@ }, { "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" - }, - { - "$ref": "#/components/schemas/_types.aggregations:TermAggregationRange" } ] }, @@ -40493,33 +40490,6 @@ } } }, - "_types.aggregations:TermAggregationRange": { - "allOf": [ - { - "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasestring" - }, - { - "type": "object" - } - ] - }, - "_types.aggregations:AggregationRangeBasestring": { - "type": "object", - "properties": { - "from": { - "description": "Start of the range (inclusive).", - "type": "string" - }, - "key": { - "description": "Custom key to return the range with.", - "type": "string" - }, - "to": { - "description": "End of the range (exclusive).", - "type": "string" - } - } - }, "_types.aggregations:GeoHashGridAggregation": { "allOf": [ { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index dd44f79a3e..59d1d236c7 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -60529,7 +60529,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1048-L1112" + "specLocation": "_types/aggregations/bucket.ts#L1044-L1108" }, { "codegenNames": [ @@ -60541,7 +60541,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1114-L1117", + "specLocation": "_types/aggregations/bucket.ts#L1110-L1113", "type": { "items": [ { @@ -60609,7 +60609,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1119-L1123" + "specLocation": "_types/aggregations/bucket.ts#L1115-L1119" }, { "inherits": { @@ -61483,7 +61483,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L986-L988", + "specLocation": "_types/aggregations/bucket.ts#L982-L984", "type": { "items": [ { @@ -61642,7 +61642,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L681-L681" + "specLocation": "_types/aggregations/bucket.ts#L677-L677" }, { "generics": [ @@ -61694,7 +61694,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L660-L673" + "specLocation": "_types/aggregations/bucket.ts#L658-L671" }, { "inherits": { @@ -61941,7 +61941,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1170-L1194" + "specLocation": "_types/aggregations/bucket.ts#L1166-L1190" }, { "kind": "interface", @@ -61986,7 +61986,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1156-L1168" + "specLocation": "_types/aggregations/bucket.ts#L1152-L1164" }, { "codegenNames": [ @@ -61998,7 +61998,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1011-L1012", + "specLocation": "_types/aggregations/bucket.ts#L1007-L1008", "type": { "items": [ { @@ -62033,7 +62033,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", + "specLocation": "_types/aggregations/bucket.ts#L1004-L1005", "type": { "items": [ { @@ -62096,7 +62096,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1014-L1023" + "specLocation": "_types/aggregations/bucket.ts#L1010-L1019" }, { "inherits": { @@ -62377,15 +62377,14 @@ "codegenNames": [ "untyped", "date", - "number", - "term" + "number" ], "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L650-L658", + "specLocation": "_types/aggregations/bucket.ts#L650-L657", "type": { "items": [ { @@ -62408,13 +62407,6 @@ "name": "NumberAggregationRange", "namespace": "_types.aggregations" } - }, - { - "kind": "instance_of", - "type": { - "name": "TermAggregationRange", - "namespace": "_types.aggregations" - } } ], "kind": "union_of" @@ -62445,7 +62437,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L679-L679" + "specLocation": "_types/aggregations/bucket.ts#L675-L675" }, { "inherits": { @@ -62469,31 +62461,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L675-L675" - }, - { - "inherits": { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - ], - "type": { - "name": "AggregationRangeBase", - "namespace": "_types.aggregations" - } - }, - "kind": "interface", - "name": { - "name": "TermAggregationRange", - "namespace": "_types.aggregations" - }, - "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L677-L677" + "specLocation": "_types/aggregations/bucket.ts#L673-L673" }, { "inherits": { @@ -63274,7 +63242,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1125-L1154" + "specLocation": "_types/aggregations/bucket.ts#L1121-L1150" }, { "inherits": { @@ -64345,7 +64313,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L990-L999" + "specLocation": "_types/aggregations/bucket.ts#L986-L995" }, { "kind": "interface", @@ -64911,7 +64879,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L692-L722" + "specLocation": "_types/aggregations/bucket.ts#L688-L718" }, { "inherits": { @@ -64998,7 +64966,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L724-L730" + "specLocation": "_types/aggregations/bucket.ts#L720-L726" }, { "inherits": { @@ -65027,7 +64995,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L732-L738" + "specLocation": "_types/aggregations/bucket.ts#L728-L734" }, { "inherits": { @@ -65335,7 +65303,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L775-L839" + "specLocation": "_types/aggregations/bucket.ts#L771-L835" }, { "kind": "interface", @@ -65369,7 +65337,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L740-L749" + "specLocation": "_types/aggregations/bucket.ts#L736-L745" }, { "kind": "enum", @@ -65391,7 +65359,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1001-L1006" + "specLocation": "_types/aggregations/bucket.ts#L997-L1002" }, { "kind": "interface", @@ -65413,7 +65381,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L751-L756" + "specLocation": "_types/aggregations/bucket.ts#L747-L752" }, { "kind": "interface", @@ -65447,7 +65415,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L758-L767" + "specLocation": "_types/aggregations/bucket.ts#L754-L763" }, { "kind": "interface", @@ -65456,7 +65424,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L769-L769" + "specLocation": "_types/aggregations/bucket.ts#L765-L765" }, { "kind": "interface", @@ -65477,7 +65445,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L771-L773" + "specLocation": "_types/aggregations/bucket.ts#L767-L769" }, { "inherits": { @@ -65698,7 +65666,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L841-L913" + "specLocation": "_types/aggregations/bucket.ts#L837-L909" }, { "inherits": { @@ -66005,7 +65973,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L915-L980" + "specLocation": "_types/aggregations/bucket.ts#L911-L976" }, { "inherits": { @@ -66629,7 +66597,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1025-L1046" + "specLocation": "_types/aggregations/bucket.ts#L1021-L1042" }, { "kind": "interface", @@ -77459,7 +77427,7 @@ "name": "FieldDateMath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L683-L690", + "specLocation": "_types/aggregations/bucket.ts#L679-L686", "type": { "items": [ { diff --git a/output/schema/schema.json b/output/schema/schema.json index cbd94e2063..cfaffce8ad 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -49738,7 +49738,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L986-L988", + "specLocation": "_types/aggregations/bucket.ts#L982-L984", "type": { "items": [ { @@ -50930,15 +50930,14 @@ "codegenNames": [ "untyped", "date", - "number", - "term" + "number" ], "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L650-L658", + "specLocation": "_types/aggregations/bucket.ts#L650-L657", "type": { "items": [ { @@ -50961,13 +50960,6 @@ "name": "NumberAggregationRange", "namespace": "_types.aggregations" } - }, - { - "kind": "instance_of", - "type": { - "name": "TermAggregationRange", - "namespace": "_types.aggregations" - } } ], "kind": "union_of" @@ -51030,7 +51022,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L660-L673" + "specLocation": "_types/aggregations/bucket.ts#L658-L671" }, { "kind": "interface", @@ -52301,7 +52293,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1048-L1112" + "specLocation": "_types/aggregations/bucket.ts#L1044-L1108" }, { "codegenNames": [ @@ -52313,7 +52305,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1114-L1117", + "specLocation": "_types/aggregations/bucket.ts#L1110-L1113", "type": { "items": [ { @@ -52366,7 +52358,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L740-L749" + "specLocation": "_types/aggregations/bucket.ts#L736-L745" }, { "attachedBehaviors": [ @@ -52981,7 +52973,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1119-L1123" + "specLocation": "_types/aggregations/bucket.ts#L1115-L1119" }, { "inherits": { @@ -53005,7 +52997,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L681-L681" + "specLocation": "_types/aggregations/bucket.ts#L677-L677" }, { "inherits": { @@ -54045,7 +54037,7 @@ "name": "FieldDateMath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L683-L690", + "specLocation": "_types/aggregations/bucket.ts#L679-L686", "type": { "items": [ { @@ -54356,7 +54348,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1170-L1194" + "specLocation": "_types/aggregations/bucket.ts#L1166-L1190" }, { "attachedBehaviors": [ @@ -54456,7 +54448,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1156-L1168" + "specLocation": "_types/aggregations/bucket.ts#L1152-L1164" }, { "kind": "enum", @@ -55327,7 +55319,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L751-L756" + "specLocation": "_types/aggregations/bucket.ts#L747-L752" }, { "kind": "interface", @@ -56216,7 +56208,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1125-L1154" + "specLocation": "_types/aggregations/bucket.ts#L1121-L1150" }, { "attachedBehaviors": [ @@ -57822,7 +57814,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L758-L767" + "specLocation": "_types/aggregations/bucket.ts#L754-L763" }, { "attachedBehaviors": [ @@ -57956,7 +57948,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L675-L675" + "specLocation": "_types/aggregations/bucket.ts#L673-L673" }, { "attachedBehaviors": [ @@ -58012,7 +58004,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L769-L769" + "specLocation": "_types/aggregations/bucket.ts#L765-L765" }, { "inherits": { @@ -58601,7 +58593,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L692-L722" + "specLocation": "_types/aggregations/bucket.ts#L688-L718" }, { "inherits": { @@ -58746,7 +58738,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L724-L730" + "specLocation": "_types/aggregations/bucket.ts#L720-L726" }, { "attachedBehaviors": [ @@ -58794,7 +58786,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L732-L738" + "specLocation": "_types/aggregations/bucket.ts#L728-L734" }, { "kind": "enum", @@ -58837,7 +58829,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L771-L773" + "specLocation": "_types/aggregations/bucket.ts#L767-L769" }, { "inherits": { @@ -59343,7 +59335,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L775-L839" + "specLocation": "_types/aggregations/bucket.ts#L771-L835" }, { "attachedBehaviors": [ @@ -59605,7 +59597,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L841-L913" + "specLocation": "_types/aggregations/bucket.ts#L837-L909" }, { "inherits": { @@ -60746,30 +60738,6 @@ }, "specLocation": "_types/aggregations/metric.ts#L322-L335" }, - { - "inherits": { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - ], - "type": { - "name": "AggregationRangeBase", - "namespace": "_types.aggregations" - } - }, - "kind": "interface", - "name": { - "name": "TermAggregationRange", - "namespace": "_types.aggregations" - }, - "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L677-L677" - }, { "generics": [ { @@ -61039,7 +61007,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L915-L980" + "specLocation": "_types/aggregations/bucket.ts#L911-L976" }, { "kind": "enum", @@ -61057,7 +61025,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L990-L999" + "specLocation": "_types/aggregations/bucket.ts#L986-L995" }, { "kind": "enum", @@ -61079,7 +61047,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1001-L1006" + "specLocation": "_types/aggregations/bucket.ts#L997-L1002" }, { "attachedBehaviors": [ @@ -61121,7 +61089,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1011-L1012", + "specLocation": "_types/aggregations/bucket.ts#L1007-L1008", "type": { "items": [ { @@ -61156,7 +61124,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", + "specLocation": "_types/aggregations/bucket.ts#L1004-L1005", "type": { "items": [ { @@ -61219,7 +61187,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1014-L1023" + "specLocation": "_types/aggregations/bucket.ts#L1010-L1019" }, { "kind": "interface", @@ -61799,7 +61767,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L679-L679" + "specLocation": "_types/aggregations/bucket.ts#L675-L675" }, { "description": "Value count aggregation result. `value` is always present.", @@ -61966,7 +61934,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1025-L1046" + "specLocation": "_types/aggregations/bucket.ts#L1021-L1042" }, { "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 457f85c6a4..22c5f828e6 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2988,7 +2988,7 @@ export interface AggregationsAggregationContainer { variable_width_histogram?: AggregationsVariableWidthHistogramAggregation } -export type AggregationsAggregationRange = AggregationsUntypedAggregationRange | AggregationsDateAggregationRange | AggregationsNumberAggregationRange | AggregationsTermAggregationRange +export type AggregationsAggregationRange = AggregationsUntypedAggregationRange | AggregationsDateAggregationRange | AggregationsNumberAggregationRange export interface AggregationsAggregationRangeBase { from?: T @@ -4131,9 +4131,6 @@ export interface AggregationsTTestAggregation { export type AggregationsTTestType = 'paired' | 'homoscedastic' | 'heteroscedastic' -export interface AggregationsTermAggregationRange extends AggregationsAggregationRangeBase { -} - export interface AggregationsTermsAggregateBase extends AggregationsMultiBucketAggregateBase { doc_count_error_upper_bound?: long sum_other_doc_count?: long diff --git a/specification/_types/aggregations/bucket.ts b/specification/_types/aggregations/bucket.ts index 6e11d90e8e..dd7281fef8 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -648,15 +648,13 @@ export class RangeAggregation extends BucketAggregationBase { } /** - * @codegen_names untyped, date, number, term + * @codegen_names untyped, date, number * @variants untagged untyped=_types.aggregations.UntypedAggregationRange */ export type AggregationRange = | UntypedAggregationRange | DateAggregationRange | NumberAggregationRange - | TermAggregationRange - export class AggregationRangeBase { /** * Start of the range (inclusive). @@ -674,8 +672,6 @@ export class AggregationRangeBase { export class NumberAggregationRange extends AggregationRangeBase {} -export class TermAggregationRange extends AggregationRangeBase {} - export class UntypedAggregationRange extends AggregationRangeBase {} export class DateAggregationRange extends AggregationRangeBase {} From 985e70b378867792fac26e0160b0437b475b425f Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Thu, 18 Jul 2024 16:50:05 +0200 Subject: [PATCH 4/4] Revert "removed term range aggregation" This reverts commit 1f832eff515668b607e0d3e4c97cbce48439c11a. --- output/openapi/elasticsearch-openapi.json | 30 ++++++ .../elasticsearch-serverless-openapi.json | 30 ++++++ output/schema/schema-serverless.json | 94 +++++++++++++------ output/schema/schema.json | 94 +++++++++++++------ output/typescript/types.ts | 5 +- specification/_types/aggregations/bucket.ts | 6 +- 6 files changed, 195 insertions(+), 64 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index dce1ae3aab..cb42c6037f 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -63797,6 +63797,9 @@ }, { "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:TermAggregationRange" } ] }, @@ -63854,6 +63857,33 @@ } } }, + "_types.aggregations:TermAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasestring" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBasestring": { + "type": "object", + "properties": { + "from": { + "description": "Start of the range (inclusive).", + "type": "string" + }, + "key": { + "description": "Custom key to return the range with.", + "type": "string" + }, + "to": { + "description": "End of the range (exclusive).", + "type": "string" + } + } + }, "_types.aggregations:GeoHashGridAggregation": { "allOf": [ { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 86329f10ea..684679af8d 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -40433,6 +40433,9 @@ }, { "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:TermAggregationRange" } ] }, @@ -40490,6 +40493,33 @@ } } }, + "_types.aggregations:TermAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasestring" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBasestring": { + "type": "object", + "properties": { + "from": { + "description": "Start of the range (inclusive).", + "type": "string" + }, + "key": { + "description": "Custom key to return the range with.", + "type": "string" + }, + "to": { + "description": "End of the range (exclusive).", + "type": "string" + } + } + }, "_types.aggregations:GeoHashGridAggregation": { "allOf": [ { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 59d1d236c7..dd44f79a3e 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -60529,7 +60529,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1044-L1108" + "specLocation": "_types/aggregations/bucket.ts#L1048-L1112" }, { "codegenNames": [ @@ -60541,7 +60541,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1110-L1113", + "specLocation": "_types/aggregations/bucket.ts#L1114-L1117", "type": { "items": [ { @@ -60609,7 +60609,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1115-L1119" + "specLocation": "_types/aggregations/bucket.ts#L1119-L1123" }, { "inherits": { @@ -61483,7 +61483,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L982-L984", + "specLocation": "_types/aggregations/bucket.ts#L986-L988", "type": { "items": [ { @@ -61642,7 +61642,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L677-L677" + "specLocation": "_types/aggregations/bucket.ts#L681-L681" }, { "generics": [ @@ -61694,7 +61694,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L658-L671" + "specLocation": "_types/aggregations/bucket.ts#L660-L673" }, { "inherits": { @@ -61941,7 +61941,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1166-L1190" + "specLocation": "_types/aggregations/bucket.ts#L1170-L1194" }, { "kind": "interface", @@ -61986,7 +61986,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1152-L1164" + "specLocation": "_types/aggregations/bucket.ts#L1156-L1168" }, { "codegenNames": [ @@ -61998,7 +61998,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1007-L1008", + "specLocation": "_types/aggregations/bucket.ts#L1011-L1012", "type": { "items": [ { @@ -62033,7 +62033,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1004-L1005", + "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", "type": { "items": [ { @@ -62096,7 +62096,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1010-L1019" + "specLocation": "_types/aggregations/bucket.ts#L1014-L1023" }, { "inherits": { @@ -62377,14 +62377,15 @@ "codegenNames": [ "untyped", "date", - "number" + "number", + "term" ], "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L650-L657", + "specLocation": "_types/aggregations/bucket.ts#L650-L658", "type": { "items": [ { @@ -62407,6 +62408,13 @@ "name": "NumberAggregationRange", "namespace": "_types.aggregations" } + }, + { + "kind": "instance_of", + "type": { + "name": "TermAggregationRange", + "namespace": "_types.aggregations" + } } ], "kind": "union_of" @@ -62437,7 +62445,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L675-L675" + "specLocation": "_types/aggregations/bucket.ts#L679-L679" }, { "inherits": { @@ -62461,7 +62469,31 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L673-L673" + "specLocation": "_types/aggregations/bucket.ts#L675-L675" + }, + { + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "TermAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L677-L677" }, { "inherits": { @@ -63242,7 +63274,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1121-L1150" + "specLocation": "_types/aggregations/bucket.ts#L1125-L1154" }, { "inherits": { @@ -64313,7 +64345,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L986-L995" + "specLocation": "_types/aggregations/bucket.ts#L990-L999" }, { "kind": "interface", @@ -64879,7 +64911,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L688-L718" + "specLocation": "_types/aggregations/bucket.ts#L692-L722" }, { "inherits": { @@ -64966,7 +64998,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L720-L726" + "specLocation": "_types/aggregations/bucket.ts#L724-L730" }, { "inherits": { @@ -64995,7 +65027,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L728-L734" + "specLocation": "_types/aggregations/bucket.ts#L732-L738" }, { "inherits": { @@ -65303,7 +65335,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L771-L835" + "specLocation": "_types/aggregations/bucket.ts#L775-L839" }, { "kind": "interface", @@ -65337,7 +65369,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L736-L745" + "specLocation": "_types/aggregations/bucket.ts#L740-L749" }, { "kind": "enum", @@ -65359,7 +65391,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L997-L1002" + "specLocation": "_types/aggregations/bucket.ts#L1001-L1006" }, { "kind": "interface", @@ -65381,7 +65413,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L747-L752" + "specLocation": "_types/aggregations/bucket.ts#L751-L756" }, { "kind": "interface", @@ -65415,7 +65447,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L754-L763" + "specLocation": "_types/aggregations/bucket.ts#L758-L767" }, { "kind": "interface", @@ -65424,7 +65456,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L765-L765" + "specLocation": "_types/aggregations/bucket.ts#L769-L769" }, { "kind": "interface", @@ -65445,7 +65477,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L767-L769" + "specLocation": "_types/aggregations/bucket.ts#L771-L773" }, { "inherits": { @@ -65666,7 +65698,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L837-L909" + "specLocation": "_types/aggregations/bucket.ts#L841-L913" }, { "inherits": { @@ -65973,7 +66005,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L911-L976" + "specLocation": "_types/aggregations/bucket.ts#L915-L980" }, { "inherits": { @@ -66597,7 +66629,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1021-L1042" + "specLocation": "_types/aggregations/bucket.ts#L1025-L1046" }, { "kind": "interface", @@ -77427,7 +77459,7 @@ "name": "FieldDateMath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L679-L686", + "specLocation": "_types/aggregations/bucket.ts#L683-L690", "type": { "items": [ { diff --git a/output/schema/schema.json b/output/schema/schema.json index cfaffce8ad..cbd94e2063 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -49738,7 +49738,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L982-L984", + "specLocation": "_types/aggregations/bucket.ts#L986-L988", "type": { "items": [ { @@ -50930,14 +50930,15 @@ "codegenNames": [ "untyped", "date", - "number" + "number", + "term" ], "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L650-L657", + "specLocation": "_types/aggregations/bucket.ts#L650-L658", "type": { "items": [ { @@ -50960,6 +50961,13 @@ "name": "NumberAggregationRange", "namespace": "_types.aggregations" } + }, + { + "kind": "instance_of", + "type": { + "name": "TermAggregationRange", + "namespace": "_types.aggregations" + } } ], "kind": "union_of" @@ -51022,7 +51030,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L658-L671" + "specLocation": "_types/aggregations/bucket.ts#L660-L673" }, { "kind": "interface", @@ -52293,7 +52301,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1044-L1108" + "specLocation": "_types/aggregations/bucket.ts#L1048-L1112" }, { "codegenNames": [ @@ -52305,7 +52313,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1110-L1113", + "specLocation": "_types/aggregations/bucket.ts#L1114-L1117", "type": { "items": [ { @@ -52358,7 +52366,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L736-L745" + "specLocation": "_types/aggregations/bucket.ts#L740-L749" }, { "attachedBehaviors": [ @@ -52973,7 +52981,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1115-L1119" + "specLocation": "_types/aggregations/bucket.ts#L1119-L1123" }, { "inherits": { @@ -52997,7 +53005,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L677-L677" + "specLocation": "_types/aggregations/bucket.ts#L681-L681" }, { "inherits": { @@ -54037,7 +54045,7 @@ "name": "FieldDateMath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L679-L686", + "specLocation": "_types/aggregations/bucket.ts#L683-L690", "type": { "items": [ { @@ -54348,7 +54356,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1166-L1190" + "specLocation": "_types/aggregations/bucket.ts#L1170-L1194" }, { "attachedBehaviors": [ @@ -54448,7 +54456,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1152-L1164" + "specLocation": "_types/aggregations/bucket.ts#L1156-L1168" }, { "kind": "enum", @@ -55319,7 +55327,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L747-L752" + "specLocation": "_types/aggregations/bucket.ts#L751-L756" }, { "kind": "interface", @@ -56208,7 +56216,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1121-L1150" + "specLocation": "_types/aggregations/bucket.ts#L1125-L1154" }, { "attachedBehaviors": [ @@ -57814,7 +57822,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L754-L763" + "specLocation": "_types/aggregations/bucket.ts#L758-L767" }, { "attachedBehaviors": [ @@ -57948,7 +57956,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L673-L673" + "specLocation": "_types/aggregations/bucket.ts#L675-L675" }, { "attachedBehaviors": [ @@ -58004,7 +58012,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L765-L765" + "specLocation": "_types/aggregations/bucket.ts#L769-L769" }, { "inherits": { @@ -58593,7 +58601,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L688-L718" + "specLocation": "_types/aggregations/bucket.ts#L692-L722" }, { "inherits": { @@ -58738,7 +58746,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L720-L726" + "specLocation": "_types/aggregations/bucket.ts#L724-L730" }, { "attachedBehaviors": [ @@ -58786,7 +58794,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L728-L734" + "specLocation": "_types/aggregations/bucket.ts#L732-L738" }, { "kind": "enum", @@ -58829,7 +58837,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L767-L769" + "specLocation": "_types/aggregations/bucket.ts#L771-L773" }, { "inherits": { @@ -59335,7 +59343,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L771-L835" + "specLocation": "_types/aggregations/bucket.ts#L775-L839" }, { "attachedBehaviors": [ @@ -59597,7 +59605,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L837-L909" + "specLocation": "_types/aggregations/bucket.ts#L841-L913" }, { "inherits": { @@ -60738,6 +60746,30 @@ }, "specLocation": "_types/aggregations/metric.ts#L322-L335" }, + { + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "TermAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L677-L677" + }, { "generics": [ { @@ -61007,7 +61039,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L911-L976" + "specLocation": "_types/aggregations/bucket.ts#L915-L980" }, { "kind": "enum", @@ -61025,7 +61057,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L986-L995" + "specLocation": "_types/aggregations/bucket.ts#L990-L999" }, { "kind": "enum", @@ -61047,7 +61079,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L997-L1002" + "specLocation": "_types/aggregations/bucket.ts#L1001-L1006" }, { "attachedBehaviors": [ @@ -61089,7 +61121,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1007-L1008", + "specLocation": "_types/aggregations/bucket.ts#L1011-L1012", "type": { "items": [ { @@ -61124,7 +61156,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1004-L1005", + "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", "type": { "items": [ { @@ -61187,7 +61219,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1010-L1019" + "specLocation": "_types/aggregations/bucket.ts#L1014-L1023" }, { "kind": "interface", @@ -61767,7 +61799,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L675-L675" + "specLocation": "_types/aggregations/bucket.ts#L679-L679" }, { "description": "Value count aggregation result. `value` is always present.", @@ -61934,7 +61966,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1021-L1042" + "specLocation": "_types/aggregations/bucket.ts#L1025-L1046" }, { "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 22c5f828e6..457f85c6a4 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2988,7 +2988,7 @@ export interface AggregationsAggregationContainer { variable_width_histogram?: AggregationsVariableWidthHistogramAggregation } -export type AggregationsAggregationRange = AggregationsUntypedAggregationRange | AggregationsDateAggregationRange | AggregationsNumberAggregationRange +export type AggregationsAggregationRange = AggregationsUntypedAggregationRange | AggregationsDateAggregationRange | AggregationsNumberAggregationRange | AggregationsTermAggregationRange export interface AggregationsAggregationRangeBase { from?: T @@ -4131,6 +4131,9 @@ export interface AggregationsTTestAggregation { export type AggregationsTTestType = 'paired' | 'homoscedastic' | 'heteroscedastic' +export interface AggregationsTermAggregationRange extends AggregationsAggregationRangeBase { +} + export interface AggregationsTermsAggregateBase extends AggregationsMultiBucketAggregateBase { doc_count_error_upper_bound?: long sum_other_doc_count?: long diff --git a/specification/_types/aggregations/bucket.ts b/specification/_types/aggregations/bucket.ts index dd7281fef8..6e11d90e8e 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -648,13 +648,15 @@ export class RangeAggregation extends BucketAggregationBase { } /** - * @codegen_names untyped, date, number + * @codegen_names untyped, date, number, term * @variants untagged untyped=_types.aggregations.UntypedAggregationRange */ export type AggregationRange = | UntypedAggregationRange | DateAggregationRange | NumberAggregationRange + | TermAggregationRange + export class AggregationRangeBase { /** * Start of the range (inclusive). @@ -672,6 +674,8 @@ export class AggregationRangeBase { export class NumberAggregationRange extends AggregationRangeBase {} +export class TermAggregationRange extends AggregationRangeBase {} + export class UntypedAggregationRange extends AggregationRangeBase {} export class DateAggregationRange extends AggregationRangeBase {}