diff --git a/compiler/src/steps/validate-model.ts b/compiler/src/steps/validate-model.ts index 86e7530f81..484e5e8c0c 100644 --- a/compiler/src/steps/validate-model.ts +++ b/compiler/src/steps/validate-model.ts @@ -608,7 +608,8 @@ 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.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..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": { @@ -63778,6 +63788,59 @@ ] }, "_types.aggregations:AggregationRange": { + "oneOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:UntypedAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:DateAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:TermAggregationRange" + } + ] + }, + "_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 +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 d67a07918c..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": { @@ -40414,6 +40424,59 @@ ] }, "_types.aggregations:AggregationRange": { + "oneOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:UntypedAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:DateAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:NumberAggregationRange" + }, + { + "$ref": "#/components/schemas/_types.aggregations:TermAggregationRange" + } + ] + }, + "_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 +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 17a06964ac..dd44f79a3e 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#L1048-L1112" }, { "codegenNames": [ @@ -60541,7 +60541,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1111-L1114", + "specLocation": "_types/aggregations/bucket.ts#L1114-L1117", "type": { "items": [ { @@ -60609,7 +60609,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1116-L1120" + "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#L983-L985", + "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": "DateAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L681-L681" + }, + { + "generics": [ + { + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" + } + ], "kind": "interface", "name": { - "name": "DateRangeExpression", + "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#L1167-L1191" + "specLocation": "_types/aggregations/bucket.ts#L1170-L1194" }, { "kind": "interface", @@ -62003,7 +61986,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1153-L1165" + "specLocation": "_types/aggregations/bucket.ts#L1156-L1168" }, { "codegenNames": [ @@ -62015,7 +61998,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", + "specLocation": "_types/aggregations/bucket.ts#L1011-L1012", "type": { "items": [ { @@ -62050,7 +62033,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1005-L1006", + "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", "type": { "items": [ { @@ -62113,7 +62096,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1011-L1020" + "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,53 +62371,129 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L382-L405" + "specLocation": "_types/aggregations/bucket.ts#L358-L381" }, { - "kind": "interface", + "codegenNames": [ + "untyped", + "date", + "number", + "term" + ], + "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, - "properties": [ - { - "description": "Start of the range (inclusive).", - "name": "from", - "required": false, - "type": { + "specLocation": "_types/aggregations/bucket.ts#L650-L658", + "type": { + "items": [ + { "kind": "instance_of", "type": { - "name": "double", - "namespace": "_types" + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" } - } - }, - { - "description": "Custom key to return the range with.", - "name": "key", - "required": false, - "type": { + }, + { "kind": "instance_of", "type": { - "name": "string", - "namespace": "_builtins" + "name": "DateAggregationRange", + "namespace": "_types.aggregations" + } + }, + { + "kind": "instance_of", + "type": { + "name": "NumberAggregationRange", + "namespace": "_types.aggregations" + } + }, + { + "kind": "instance_of", + "type": { + "name": "TermAggregationRange", + "namespace": "_types.aggregations" } } - }, - { - "description": "End of the range (exclusive).", - "name": "to", - "required": false, - "type": { + ], + "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#L679-L679" + }, + { + "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#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": { @@ -62512,7 +62571,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L407-L432" + "specLocation": "_types/aggregations/bucket.ts#L383-L408" }, { "codegenNames": [ @@ -62738,7 +62797,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L434-L460" + "specLocation": "_types/aggregations/bucket.ts#L410-L436" }, { "kind": "type_alias", @@ -62831,7 +62890,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L462-L487" + "specLocation": "_types/aggregations/bucket.ts#L438-L463" }, { "inherits": { @@ -62846,7 +62905,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L489-L489" + "specLocation": "_types/aggregations/bucket.ts#L465-L465" }, { "inherits": { @@ -63011,7 +63070,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L502-L548" + "specLocation": "_types/aggregations/bucket.ts#L478-L524" }, { "inherits": { @@ -63054,7 +63113,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L550-L559" + "specLocation": "_types/aggregations/bucket.ts#L526-L535" }, { "kind": "interface", @@ -63124,7 +63183,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L561-L574" + "specLocation": "_types/aggregations/bucket.ts#L537-L550" }, { "inherits": { @@ -63215,7 +63274,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1122-L1151" + "specLocation": "_types/aggregations/bucket.ts#L1125-L1154" }, { "inherits": { @@ -63610,7 +63669,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L576-L582" + "specLocation": "_types/aggregations/bucket.ts#L552-L558" }, { "kind": "type_alias", @@ -64268,7 +64327,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L584-L624" + "specLocation": "_types/aggregations/bucket.ts#L560-L600" }, { "kind": "enum", @@ -64286,7 +64345,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L987-L996" + "specLocation": "_types/aggregations/bucket.ts#L990-L999" }, { "kind": "interface", @@ -64320,7 +64379,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L626-L636" + "specLocation": "_types/aggregations/bucket.ts#L602-L612" }, { "inherits": { @@ -64348,7 +64407,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L638-L643" + "specLocation": "_types/aggregations/bucket.ts#L614-L619" }, { "inherits": { @@ -64439,7 +64498,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L645-L650" + "specLocation": "_types/aggregations/bucket.ts#L621-L626" }, { "inherits": { @@ -64751,7 +64810,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L652-L672" + "specLocation": "_types/aggregations/bucket.ts#L628-L648" }, { "inherits": { @@ -64852,7 +64911,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L689-L719" + "specLocation": "_types/aggregations/bucket.ts#L692-L722" }, { "inherits": { @@ -64939,7 +64998,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L721-L727" + "specLocation": "_types/aggregations/bucket.ts#L724-L730" }, { "inherits": { @@ -64968,7 +65027,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L729-L735" + "specLocation": "_types/aggregations/bucket.ts#L732-L738" }, { "inherits": { @@ -65276,7 +65335,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L772-L836" + "specLocation": "_types/aggregations/bucket.ts#L775-L839" }, { "kind": "interface", @@ -65310,7 +65369,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L737-L746" + "specLocation": "_types/aggregations/bucket.ts#L740-L749" }, { "kind": "enum", @@ -65332,7 +65391,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L998-L1003" + "specLocation": "_types/aggregations/bucket.ts#L1001-L1006" }, { "kind": "interface", @@ -65354,7 +65413,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L748-L753" + "specLocation": "_types/aggregations/bucket.ts#L751-L756" }, { "kind": "interface", @@ -65388,7 +65447,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L755-L764" + "specLocation": "_types/aggregations/bucket.ts#L758-L767" }, { "kind": "interface", @@ -65397,7 +65456,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L766-L766" + "specLocation": "_types/aggregations/bucket.ts#L769-L769" }, { "kind": "interface", @@ -65418,7 +65477,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L768-L770" + "specLocation": "_types/aggregations/bucket.ts#L771-L773" }, { "inherits": { @@ -65639,7 +65698,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L838-L910" + "specLocation": "_types/aggregations/bucket.ts#L841-L913" }, { "inherits": { @@ -65946,7 +66005,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L912-L977" + "specLocation": "_types/aggregations/bucket.ts#L915-L980" }, { "inherits": { @@ -66570,7 +66629,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1022-L1043" + "specLocation": "_types/aggregations/bucket.ts#L1025-L1046" }, { "kind": "interface", @@ -76241,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": { @@ -77374,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 e5eaf5d5ea..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#L983-L985", + "specLocation": "_types/aggregations/bucket.ts#L986-L988", "type": { "items": [ { @@ -50927,11 +50927,71 @@ } }, { - "kind": "interface", + "codegenNames": [ + "untyped", + "date", + "number", + "term" + ], + "kind": "type_alias", "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, + "specLocation": "_types/aggregations/bucket.ts#L650-L658", + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" + } + }, + { + "kind": "instance_of", + "type": { + "name": "DateAggregationRange", + "namespace": "_types.aggregations" + } + }, + { + "kind": "instance_of", + "type": { + "name": "NumberAggregationRange", + "namespace": "_types.aggregations" + } + }, + { + "kind": "instance_of", + "type": { + "name": "TermAggregationRange", + "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 +51000,8 @@ "type": { "kind": "instance_of", "type": { - "name": "double", - "namespace": "_types" + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" } } }, @@ -50964,13 +51024,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#L660-L673" }, { "kind": "interface", @@ -52241,7 +52301,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1045-L1109" + "specLocation": "_types/aggregations/bucket.ts#L1048-L1112" }, { "codegenNames": [ @@ -52253,7 +52313,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1111-L1114", + "specLocation": "_types/aggregations/bucket.ts#L1114-L1117", "type": { "items": [ { @@ -52306,7 +52366,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L737-L746" + "specLocation": "_types/aggregations/bucket.ts#L740-L749" }, { "attachedBehaviors": [ @@ -52921,7 +52981,31 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1116-L1120" + "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": { @@ -53295,7 +53379,7 @@ "value": { "kind": "instance_of", "type": { - "name": "DateRangeExpression", + "name": "DateAggregationRange", "namespace": "_types.aggregations" } } @@ -53328,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": { @@ -53504,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.", @@ -53667,7 +53705,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L491-L500" + "specLocation": "_types/aggregations/bucket.ts#L467-L476" }, { "inherits": { @@ -54007,7 +54045,7 @@ "name": "FieldDateMath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L298-L305", + "specLocation": "_types/aggregations/bucket.ts#L683-L690", "type": { "items": [ { @@ -54145,7 +54183,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L360-L380" + "specLocation": "_types/aggregations/bucket.ts#L336-L356" }, { "attachedBehaviors": [ @@ -54318,7 +54356,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1167-L1191" + "specLocation": "_types/aggregations/bucket.ts#L1170-L1194" }, { "attachedBehaviors": [ @@ -54418,7 +54456,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1153-L1165" + "specLocation": "_types/aggregations/bucket.ts#L1156-L1168" }, { "kind": "enum", @@ -54672,7 +54710,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L382-L405" + "specLocation": "_types/aggregations/bucket.ts#L358-L381" }, { "inherits": { @@ -54775,7 +54813,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L407-L432" + "specLocation": "_types/aggregations/bucket.ts#L383-L408" }, { "attachedBehaviors": [ @@ -55125,7 +55163,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L434-L460" + "specLocation": "_types/aggregations/bucket.ts#L410-L436" }, { "attachedBehaviors": [ @@ -55233,7 +55271,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L462-L487" + "specLocation": "_types/aggregations/bucket.ts#L438-L463" }, { "attachedBehaviors": [ @@ -55267,7 +55305,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L489-L489" + "specLocation": "_types/aggregations/bucket.ts#L465-L465" }, { "kind": "interface", @@ -55289,7 +55327,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L748-L753" + "specLocation": "_types/aggregations/bucket.ts#L751-L756" }, { "kind": "interface", @@ -55533,7 +55571,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L502-L548" + "specLocation": "_types/aggregations/bucket.ts#L478-L524" }, { "attachedBehaviors": [ @@ -56178,7 +56216,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1122-L1151" + "specLocation": "_types/aggregations/bucket.ts#L1125-L1154" }, { "attachedBehaviors": [ @@ -56309,7 +56347,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L550-L559" + "specLocation": "_types/aggregations/bucket.ts#L526-L535" }, { "kind": "interface", @@ -56379,7 +56417,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L561-L574" + "specLocation": "_types/aggregations/bucket.ts#L537-L550" }, { "attachedBehaviors": [ @@ -57196,7 +57234,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L576-L582" + "specLocation": "_types/aggregations/bucket.ts#L552-L558" }, { "kind": "enum", @@ -57550,7 +57588,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L626-L636" + "specLocation": "_types/aggregations/bucket.ts#L602-L612" }, { "inherits": { @@ -57695,7 +57733,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L584-L624" + "specLocation": "_types/aggregations/bucket.ts#L560-L600" }, { "attachedBehaviors": [ @@ -57784,7 +57822,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L755-L764" + "specLocation": "_types/aggregations/bucket.ts#L758-L767" }, { "attachedBehaviors": [ @@ -57831,7 +57869,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L638-L643" + "specLocation": "_types/aggregations/bucket.ts#L614-L619" }, { "inherits": { @@ -57896,6 +57934,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#L675-L675" + }, { "attachedBehaviors": [ "AdditionalProperties" @@ -57941,7 +58003,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L645-L650" + "specLocation": "_types/aggregations/bucket.ts#L621-L626" }, { "kind": "interface", @@ -57950,7 +58012,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L766-L766" + "specLocation": "_types/aggregations/bucket.ts#L769-L769" }, { "inherits": { @@ -58363,7 +58425,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L652-L672" + "specLocation": "_types/aggregations/bucket.ts#L628-L648" }, { "attachedBehaviors": [ @@ -58539,7 +58601,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L689-L719" + "specLocation": "_types/aggregations/bucket.ts#L692-L722" }, { "inherits": { @@ -58684,7 +58746,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L721-L727" + "specLocation": "_types/aggregations/bucket.ts#L724-L730" }, { "attachedBehaviors": [ @@ -58732,7 +58794,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L729-L735" + "specLocation": "_types/aggregations/bucket.ts#L732-L738" }, { "kind": "enum", @@ -58754,7 +58816,7 @@ "name": "SamplerAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L345-L358" + "specLocation": "_types/aggregations/bucket.ts#L321-L334" }, { "kind": "interface", @@ -58775,7 +58837,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L768-L770" + "specLocation": "_types/aggregations/bucket.ts#L771-L773" }, { "inherits": { @@ -59281,7 +59343,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L772-L836" + "specLocation": "_types/aggregations/bucket.ts#L775-L839" }, { "attachedBehaviors": [ @@ -59543,7 +59605,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L838-L910" + "specLocation": "_types/aggregations/bucket.ts#L841-L913" }, { "inherits": { @@ -60684,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": [ { @@ -60953,7 +61039,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L912-L977" + "specLocation": "_types/aggregations/bucket.ts#L915-L980" }, { "kind": "enum", @@ -60971,7 +61057,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L987-L996" + "specLocation": "_types/aggregations/bucket.ts#L990-L999" }, { "kind": "enum", @@ -60993,7 +61079,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L998-L1003" + "specLocation": "_types/aggregations/bucket.ts#L1001-L1006" }, { "attachedBehaviors": [ @@ -61035,7 +61121,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", + "specLocation": "_types/aggregations/bucket.ts#L1011-L1012", "type": { "items": [ { @@ -61070,7 +61156,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1005-L1006", + "specLocation": "_types/aggregations/bucket.ts#L1008-L1009", "type": { "items": [ { @@ -61133,7 +61219,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1011-L1020" + "specLocation": "_types/aggregations/bucket.ts#L1014-L1023" }, { "kind": "interface", @@ -61695,6 +61781,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#L679-L679" + }, { "description": "Value count aggregation result. `value` is always present.", "inherits": { @@ -61860,7 +61966,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1022-L1043" + "specLocation": "_types/aggregations/bucket.ts#L1025-L1046" }, { "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 1a0bb06f1d..457f85c6a4 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 | AggregationsDateAggregationRange | AggregationsNumberAggregationRange | AggregationsTermAggregationRange + +export interface AggregationsAggregationRangeBase { + from?: T key?: string - to?: double + to?: T } export interface AggregationsArrayPercentilesItem { @@ -3214,6 +3216,9 @@ export interface AggregationsCustomCategorizeTextAnalyzer { filter?: string[] } +export interface AggregationsDateAggregationRange extends AggregationsAggregationRangeBase { +} + export interface AggregationsDateHistogramAggregate extends AggregationsMultiBucketAggregateBase { } @@ -3249,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 @@ -3811,6 +3810,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 @@ -4129,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 @@ -4230,6 +4235,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..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. @@ -671,11 +647,21 @@ export class RangeAggregation extends BucketAggregationBase { format?: string } -export class AggregationRange { +/** + * @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). */ - from?: double + from?: T /** * Custom key to return the range with. */ @@ -683,9 +669,26 @@ export class AggregationRange { /** * End of the range (exclusive). */ - to?: double + to?: T } +export class NumberAggregationRange 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.