diff --git a/compiler/src/steps/validate-model.ts b/compiler/src/steps/validate-model.ts index 272da3251b..ad7ec1745b 100644 --- a/compiler/src/steps/validate-model.ts +++ b/compiler/src/steps/validate-model.ts @@ -597,7 +597,8 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma validateValueOf(valueOf, openGenerics) } 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 ccc4530f4e..c1517bb943 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -54534,7 +54534,7 @@ "description": "Array of date ranges.", "type": "array", "items": { - "$ref": "#/components/schemas/_types.aggregations:DateRangeExpression" + "$ref": "#/components/schemas/_types.aggregations:DateAggregationRange" } }, "time_zone": { @@ -54548,7 +54548,17 @@ } ] }, - "_types.aggregations:DateRangeExpression": { + "_types.aggregations:DateAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBaseFieldDateMath" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBaseFieldDateMath": { "type": "object", "properties": { "from": { @@ -54845,19 +54855,37 @@ ] }, "_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).", - "oneOf": [ - { - "type": "number" - }, - { - "nullable": true, - "type": "string" - } - ] + "type": "object" }, "key": { "description": "Custom key to return the range with.", @@ -54865,15 +54893,61 @@ }, "to": { "description": "End of the range (exclusive).", - "oneOf": [ - { - "type": "number" - }, - { - "nullable": true, - "type": "string" - } - ] + "type": "object" + } + } + }, + "_types.aggregations:NumberAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasedouble" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBasedouble": { + "type": "object", + "properties": { + "from": { + "description": "Start of the range (inclusive).", + "type": "number" + }, + "key": { + "description": "Custom key to return the range with.", + "type": "string" + }, + "to": { + "description": "End of the range (exclusive).", + "type": "number" + } + } + }, + "_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" } } }, diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 0e278bf8bd..31fc3746c0 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -33677,7 +33677,7 @@ "description": "Array of date ranges.", "type": "array", "items": { - "$ref": "#/components/schemas/_types.aggregations:DateRangeExpression" + "$ref": "#/components/schemas/_types.aggregations:DateAggregationRange" } }, "time_zone": { @@ -33691,7 +33691,17 @@ } ] }, - "_types.aggregations:DateRangeExpression": { + "_types.aggregations:DateAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBaseFieldDateMath" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBaseFieldDateMath": { "type": "object", "properties": { "from": { @@ -33988,19 +33998,37 @@ ] }, "_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).", - "oneOf": [ - { - "type": "number" - }, - { - "nullable": true, - "type": "string" - } - ] + "type": "object" }, "key": { "description": "Custom key to return the range with.", @@ -34008,15 +34036,61 @@ }, "to": { "description": "End of the range (exclusive).", - "oneOf": [ - { - "type": "number" - }, - { - "nullable": true, - "type": "string" - } - ] + "type": "object" + } + } + }, + "_types.aggregations:NumberAggregationRange": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:AggregationRangeBasedouble" + }, + { + "type": "object" + } + ] + }, + "_types.aggregations:AggregationRangeBasedouble": { + "type": "object", + "properties": { + "from": { + "description": "Start of the range (inclusive).", + "type": "number" + }, + "key": { + "description": "Custom key to return the range with.", + "type": "string" + }, + "to": { + "description": "End of the range (exclusive).", + "type": "number" + } + } + }, + "_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" } } }, diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 193b1724f7..a578172e21 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -66565,7 +66565,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1117-L1182" + "specLocation": "_types/aggregations/bucket.ts#L1114-L1179" }, { "codegenNames": [ @@ -66577,7 +66577,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1184-L1187", + "specLocation": "_types/aggregations/bucket.ts#L1181-L1184", "type": { "items": [ { @@ -66645,7 +66645,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1189-L1193" + "specLocation": "_types/aggregations/bucket.ts#L1186-L1190" }, { "inherits": { @@ -67517,7 +67517,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L508-L517" + "specLocation": "_types/aggregations/bucket.ts#L481-L490" }, { "kind": "type_alias", @@ -67525,7 +67525,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1052-L1054", + "specLocation": "_types/aggregations/bucket.ts#L1049-L1051", "type": { "items": [ { @@ -67629,7 +67629,7 @@ "value": { "kind": "instance_of", "type": { - "name": "DateRangeExpression", + "name": "DateAggregationRange", "namespace": "_types.aggregations" } } @@ -67663,9 +67663,39 @@ "specLocation": "_types/aggregations/bucket.ts#L281-L307" }, { + "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#L695-L695" + }, + { + "generics": [ + { + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" + } + ], + "kind": "interface", + "name": { + "name": "AggregationRangeBase", "namespace": "_types.aggregations" }, "properties": [ @@ -67676,8 +67706,8 @@ "type": { "kind": "instance_of", "type": { - "name": "FieldDateMath", - "namespace": "_types.aggregations" + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" } } }, @@ -67700,60 +67730,13 @@ "type": { "kind": "instance_of", "type": { - "name": "FieldDateMath", - "namespace": "_types.aggregations" + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" } } } ], - "specLocation": "_types/aggregations/bucket.ts#L318-L331" - }, - { - "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#L309-L316", - "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#L674-L687" }, { "inherits": { @@ -67771,8 +67754,6 @@ "specLocation": "_types/aggregations/pipeline.ts#L216-L216" }, { - "extDocId": "search-aggregations-bucket-diversified-sampler-aggregation", - "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-diversified-sampler-aggregation.html", "inherits": { "type": { "name": "BucketAggregationBase", @@ -67848,7 +67829,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L333-L357" + "specLocation": "_types/aggregations/bucket.ts#L309-L330" }, { "kind": "enum", @@ -67870,7 +67851,7 @@ "name": "SamplerAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L359-L372" + "specLocation": "_types/aggregations/bucket.ts#L332-L345" }, { "inherits": { @@ -68004,7 +67985,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1240-L1267" + "specLocation": "_types/aggregations/bucket.ts#L1237-L1264" }, { "kind": "interface", @@ -68049,7 +68030,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1226-L1238" + "specLocation": "_types/aggregations/bucket.ts#L1223-L1235" }, { "codegenNames": [ @@ -68061,7 +68042,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1077-L1078", + "specLocation": "_types/aggregations/bucket.ts#L1074-L1075", "type": { "items": [ { @@ -68096,7 +68077,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1074-L1075", + "specLocation": "_types/aggregations/bucket.ts#L1071-L1072", "type": { "items": [ { @@ -68159,7 +68140,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1080-L1089" + "specLocation": "_types/aggregations/bucket.ts#L1077-L1086" }, { "inherits": { @@ -68234,7 +68215,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L374-L394" + "specLocation": "_types/aggregations/bucket.ts#L347-L367" }, { "codegenNames": [ @@ -68436,77 +68417,129 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L396-L419" + "specLocation": "_types/aggregations/bucket.ts#L369-L392" }, { - "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": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "null", - "namespace": "_builtins" - } - } - ], - "kind": "union_of" + "specLocation": "_types/aggregations/bucket.ts#L664-L672", + "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" + } } - }, - { - "description": "Custom key to return the range with.", - "name": "key", - "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#L693-L693" + }, + { + "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#L689-L689" + }, + { + "inherits": { + "generics": [ + { "kind": "instance_of", "type": { "name": "string", "namespace": "_builtins" } } - }, - { - "description": "End of the range (exclusive).", - "name": "to", - "required": false, - "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "null", - "namespace": "_builtins" - } - } - ], - "kind": "union_of" - } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" } - ], - "specLocation": "_types/aggregations/bucket.ts#L691-L704" + }, + "kind": "interface", + "name": { + "name": "TermAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L691-L691" }, { "extDocId": "search-aggregations-bucket-geohashgrid-aggregation", @@ -68586,7 +68619,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L421-L449" + "specLocation": "_types/aggregations/bucket.ts#L394-L422" }, { "codegenNames": [ @@ -68812,7 +68845,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L451-L477" + "specLocation": "_types/aggregations/bucket.ts#L424-L450" }, { "kind": "type_alias", @@ -68905,7 +68938,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L479-L504" + "specLocation": "_types/aggregations/bucket.ts#L452-L477" }, { "inherits": { @@ -68920,7 +68953,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L506-L506" + "specLocation": "_types/aggregations/bucket.ts#L479-L479" }, { "inherits": { @@ -69085,7 +69118,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L519-L565" + "specLocation": "_types/aggregations/bucket.ts#L492-L538" }, { "inherits": { @@ -69128,7 +69161,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L567-L576" + "specLocation": "_types/aggregations/bucket.ts#L540-L549" }, { "kind": "interface", @@ -69198,7 +69231,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L578-L591" + "specLocation": "_types/aggregations/bucket.ts#L551-L564" }, { "inherits": { @@ -69289,7 +69322,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1195-L1224" + "specLocation": "_types/aggregations/bucket.ts#L1192-L1221" }, { "inherits": { @@ -69690,7 +69723,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L593-L599" + "specLocation": "_types/aggregations/bucket.ts#L566-L572" }, { "kind": "type_alias", @@ -70352,7 +70385,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L601-L641" + "specLocation": "_types/aggregations/bucket.ts#L574-L614" }, { "kind": "enum", @@ -70370,7 +70403,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1056-L1065" + "specLocation": "_types/aggregations/bucket.ts#L1053-L1062" }, { "kind": "interface", @@ -70404,7 +70437,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L643-L653" + "specLocation": "_types/aggregations/bucket.ts#L616-L626" }, { "inherits": { @@ -70432,7 +70465,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L655-L660" + "specLocation": "_types/aggregations/bucket.ts#L628-L633" }, { "extDocId": "search-aggregations-pipeline-normalize-aggregation", @@ -70525,7 +70558,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L662-L667" + "specLocation": "_types/aggregations/bucket.ts#L635-L640" }, { "extDocId": "search-aggregations-metrics-percentile-rank-aggregation", @@ -70841,11 +70874,9 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L669-L689" + "specLocation": "_types/aggregations/bucket.ts#L642-L662" }, { - "extDocId": "search-aggregations-bucket-rare-terms-aggregation", - "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-rare-terms-aggregation.html", "inherits": { "type": { "name": "BucketAggregationBase", @@ -70944,7 +70975,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L706-L739" + "specLocation": "_types/aggregations/bucket.ts#L706-L736" }, { "inherits": { @@ -71031,7 +71062,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L741-L747" + "specLocation": "_types/aggregations/bucket.ts#L738-L744" }, { "extDocId": "search-aggregations-random-sampler-aggregation", @@ -71073,7 +71104,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L749-L769" + "specLocation": "_types/aggregations/bucket.ts#L746-L766" }, { "extDocId": "search-aggregations-bucket-sampler-aggregation", @@ -71104,7 +71135,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L771-L780" + "specLocation": "_types/aggregations/bucket.ts#L768-L777" }, { "inherits": { @@ -71416,7 +71447,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L817-L884" + "specLocation": "_types/aggregations/bucket.ts#L814-L881" }, { "kind": "interface", @@ -71450,7 +71481,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L782-L791" + "specLocation": "_types/aggregations/bucket.ts#L779-L788" }, { "kind": "enum", @@ -71472,7 +71503,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1067-L1072" + "specLocation": "_types/aggregations/bucket.ts#L1064-L1069" }, { "kind": "interface", @@ -71494,7 +71525,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L793-L798" + "specLocation": "_types/aggregations/bucket.ts#L790-L795" }, { "kind": "interface", @@ -71528,7 +71559,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L800-L809" + "specLocation": "_types/aggregations/bucket.ts#L797-L806" }, { "kind": "interface", @@ -71537,7 +71568,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L811-L811" + "specLocation": "_types/aggregations/bucket.ts#L808-L808" }, { "kind": "interface", @@ -71558,7 +71589,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L813-L815" + "specLocation": "_types/aggregations/bucket.ts#L810-L812" }, { "extDocId": "search-aggregations-bucket-significanttext-aggregation", @@ -71781,7 +71812,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L886-L961" + "specLocation": "_types/aggregations/bucket.ts#L883-L958" }, { "inherits": { @@ -72092,7 +72123,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L963-L1031" + "specLocation": "_types/aggregations/bucket.ts#L960-L1028" }, { "extDocId": "search-aggregations-bucket-time-series-aggregation", @@ -72135,7 +72166,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1033-L1046" + "specLocation": "_types/aggregations/bucket.ts#L1030-L1043" }, { "inherits": { @@ -72763,7 +72794,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1091-L1115" + "specLocation": "_types/aggregations/bucket.ts#L1088-L1112" }, { "kind": "interface", @@ -83543,6 +83574,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": { @@ -84674,6 +84720,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#L697-L704", + "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": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 9ae1e15916..8226deb0fb 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -55827,7 +55827,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1052-L1054", + "specLocation": "_types/aggregations/bucket.ts#L1049-L1051", "type": { "kind": "union_of", "items": [ @@ -57058,34 +57058,82 @@ } }, { - "kind": "interface", + "kind": "type_alias", + "codegenNames": [ + "untyped", + "date", + "number", + "term" + ], "name": { "name": "AggregationRange", "namespace": "_types.aggregations" }, + "specLocation": "_types/aggregations/bucket.ts#L664-L672", + "type": { + "kind": "union_of", + "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" + } + } + ] + }, + "variants": { + "kind": "untagged", + "untypedVariant": { + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" + } + } + }, + { + "kind": "interface", + "generics": [ + { + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" + } + ], + "name": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + }, "properties": [ { "description": "Start of the range (inclusive).", "name": "from", "required": false, "type": { - "kind": "union_of", - "items": [ - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "null", - "namespace": "_builtins" - } - } - ] + "kind": "instance_of", + "type": { + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" + } } }, { @@ -57105,27 +57153,15 @@ "name": "to", "required": false, "type": { - "kind": "union_of", - "items": [ - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "null", - "namespace": "_builtins" - } - } - ] + "kind": "instance_of", + "type": { + "name": "T", + "namespace": "_types.aggregations.AggregationRangeBase" + } } } ], - "specLocation": "_types/aggregations/bucket.ts#L691-L704" + "specLocation": "_types/aggregations/bucket.ts#L674-L687" }, { "kind": "interface", @@ -58418,7 +58454,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1117-L1182" + "specLocation": "_types/aggregations/bucket.ts#L1114-L1179" }, { "kind": "type_alias", @@ -58430,7 +58466,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1184-L1187", + "specLocation": "_types/aggregations/bucket.ts#L1181-L1184", "type": { "kind": "union_of", "items": [ @@ -58483,7 +58519,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L782-L791" + "specLocation": "_types/aggregations/bucket.ts#L779-L788" }, { "kind": "interface", @@ -59106,7 +59142,31 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1189-L1193" + "specLocation": "_types/aggregations/bucket.ts#L1186-L1190" + }, + { + "kind": "interface", + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "FieldDateMath", + "namespace": "_types.aggregations" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "name": { + "name": "DateAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L695-L695" }, { "kind": "interface", @@ -59484,7 +59544,7 @@ "value": { "kind": "instance_of", "type": { - "name": "DateRangeExpression", + "name": "DateAggregationRange", "namespace": "_types.aggregations" } } @@ -59517,52 +59577,6 @@ ], "specLocation": "_types/aggregations/bucket.ts#L281-L307" }, - { - "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#L318-L331" - }, { "kind": "interface", "extDocId": "search-aggregations-pipeline-derivative-aggregation", @@ -59621,8 +59635,6 @@ }, { "kind": "interface", - "extDocId": "search-aggregations-bucket-diversified-sampler-aggregation", - "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-diversified-sampler-aggregation.html", "inherits": { "type": { "name": "BucketAggregationBase", @@ -59697,7 +59709,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L333-L357" + "specLocation": "_types/aggregations/bucket.ts#L309-L330" }, { "kind": "interface", @@ -59860,7 +59872,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L508-L517" + "specLocation": "_types/aggregations/bucket.ts#L481-L490" }, { "kind": "interface", @@ -60202,7 +60214,7 @@ "name": "FieldDateMath", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L309-L316", + "specLocation": "_types/aggregations/bucket.ts#L697-L704", "type": { "kind": "union_of", "items": [ @@ -60344,7 +60356,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L374-L394" + "specLocation": "_types/aggregations/bucket.ts#L347-L367" }, { "kind": "interface", @@ -60519,7 +60531,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1240-L1267" + "specLocation": "_types/aggregations/bucket.ts#L1237-L1264" }, { "kind": "interface", @@ -60619,7 +60631,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1226-L1238" + "specLocation": "_types/aggregations/bucket.ts#L1223-L1235" }, { "kind": "enum", @@ -60881,7 +60893,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L396-L419" + "specLocation": "_types/aggregations/bucket.ts#L369-L392" }, { "kind": "interface", @@ -60986,7 +60998,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L421-L449" + "specLocation": "_types/aggregations/bucket.ts#L394-L422" }, { "kind": "interface", @@ -61340,7 +61352,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L451-L477" + "specLocation": "_types/aggregations/bucket.ts#L424-L450" }, { "kind": "interface", @@ -61448,7 +61460,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L479-L504" + "specLocation": "_types/aggregations/bucket.ts#L452-L477" }, { "kind": "interface", @@ -61484,7 +61496,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L506-L506" + "specLocation": "_types/aggregations/bucket.ts#L479-L479" }, { "kind": "interface", @@ -61506,7 +61518,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L793-L798" + "specLocation": "_types/aggregations/bucket.ts#L790-L795" }, { "kind": "interface", @@ -61752,7 +61764,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L519-L565" + "specLocation": "_types/aggregations/bucket.ts#L492-L538" }, { "kind": "interface", @@ -62401,7 +62413,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1195-L1224" + "specLocation": "_types/aggregations/bucket.ts#L1192-L1221" }, { "kind": "interface", @@ -62534,7 +62546,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L567-L576" + "specLocation": "_types/aggregations/bucket.ts#L540-L549" }, { "kind": "interface", @@ -62604,7 +62616,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L578-L591" + "specLocation": "_types/aggregations/bucket.ts#L551-L564" }, { "kind": "interface", @@ -63435,7 +63447,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L593-L599" + "specLocation": "_types/aggregations/bucket.ts#L566-L572" }, { "kind": "enum", @@ -63793,7 +63805,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L643-L653" + "specLocation": "_types/aggregations/bucket.ts#L616-L626" }, { "kind": "interface", @@ -63940,7 +63952,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L601-L641" + "specLocation": "_types/aggregations/bucket.ts#L574-L614" }, { "kind": "interface", @@ -64029,7 +64041,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L800-L809" + "specLocation": "_types/aggregations/bucket.ts#L797-L806" }, { "kind": "interface", @@ -64078,7 +64090,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L655-L660" + "specLocation": "_types/aggregations/bucket.ts#L628-L633" }, { "kind": "interface", @@ -64145,6 +64157,30 @@ }, "specLocation": "_types/aggregations/pipeline.ts#L361-L387" }, + { + "kind": "interface", + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "name": { + "name": "NumberAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L689-L689" + }, { "kind": "interface", "attachedBehaviors": [ @@ -64192,7 +64228,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L662-L667" + "specLocation": "_types/aggregations/bucket.ts#L635-L640" }, { "kind": "interface", @@ -64201,7 +64237,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L811-L811" + "specLocation": "_types/aggregations/bucket.ts#L808-L808" }, { "kind": "interface", @@ -64563,7 +64599,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L749-L769" + "specLocation": "_types/aggregations/bucket.ts#L746-L766" }, { "kind": "interface", @@ -64679,7 +64715,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L669-L689" + "specLocation": "_types/aggregations/bucket.ts#L642-L662" }, { "kind": "interface", @@ -64758,8 +64794,6 @@ }, { "kind": "interface", - "extDocId": "search-aggregations-bucket-rare-terms-aggregation", - "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-rare-terms-aggregation.html", "inherits": { "type": { "name": "BucketAggregationBase", @@ -64857,7 +64891,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L706-L739" + "specLocation": "_types/aggregations/bucket.ts#L706-L736" }, { "kind": "interface", @@ -65006,7 +65040,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L741-L747" + "specLocation": "_types/aggregations/bucket.ts#L738-L744" }, { "kind": "interface", @@ -65056,7 +65090,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L771-L780" + "specLocation": "_types/aggregations/bucket.ts#L768-L777" }, { "kind": "enum", @@ -65078,7 +65112,7 @@ "name": "SamplerAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L359-L372" + "specLocation": "_types/aggregations/bucket.ts#L332-L345" }, { "kind": "interface", @@ -65099,7 +65133,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L813-L815" + "specLocation": "_types/aggregations/bucket.ts#L810-L812" }, { "kind": "interface", @@ -65613,7 +65647,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L817-L884" + "specLocation": "_types/aggregations/bucket.ts#L814-L881" }, { "kind": "interface", @@ -65877,7 +65911,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L886-L961" + "specLocation": "_types/aggregations/bucket.ts#L883-L958" }, { "kind": "interface", @@ -67028,6 +67062,30 @@ }, "specLocation": "_types/aggregations/metric.ts#L331-L344" }, + { + "kind": "interface", + "inherits": { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "name": { + "name": "TermAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L691-L691" + }, { "kind": "interface", "generics": [ @@ -67299,7 +67357,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L963-L1031" + "specLocation": "_types/aggregations/bucket.ts#L960-L1028" }, { "kind": "enum", @@ -67317,7 +67375,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1056-L1065" + "specLocation": "_types/aggregations/bucket.ts#L1053-L1062" }, { "kind": "enum", @@ -67339,7 +67397,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1067-L1072" + "specLocation": "_types/aggregations/bucket.ts#L1064-L1069" }, { "kind": "interface", @@ -67381,7 +67439,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1077-L1078", + "specLocation": "_types/aggregations/bucket.ts#L1074-L1075", "type": { "kind": "union_of", "items": [ @@ -67416,7 +67474,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1074-L1075", + "specLocation": "_types/aggregations/bucket.ts#L1071-L1072", "type": { "kind": "union_of", "items": [ @@ -67479,7 +67537,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1080-L1089" + "specLocation": "_types/aggregations/bucket.ts#L1077-L1086" }, { "kind": "interface", @@ -67592,7 +67650,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1033-L1046" + "specLocation": "_types/aggregations/bucket.ts#L1030-L1043" }, { "kind": "interface", @@ -68154,6 +68212,26 @@ "specLocation": "_types/aggregations/Aggregate.ts#L463-L469", "variantName": "umterms" }, + { + "kind": "interface", + "inherits": { + "generics": [ + { + "kind": "user_defined_value" + } + ], + "type": { + "name": "AggregationRangeBase", + "namespace": "_types.aggregations" + } + }, + "name": { + "name": "UntypedAggregationRange", + "namespace": "_types.aggregations" + }, + "properties": [], + "specLocation": "_types/aggregations/bucket.ts#L693-L693" + }, { "kind": "interface", "description": "Value count aggregation result. `value` is always present.", @@ -68323,7 +68401,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1091-L1115" + "specLocation": "_types/aggregations/bucket.ts#L1088-L1112" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 9214f50e5f..0ebd8f9338 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -3174,10 +3174,12 @@ export interface AggregationsAggregationContainer { variable_width_histogram?: AggregationsVariableWidthHistogramAggregation } -export interface AggregationsAggregationRange { - from?: double | null +export type AggregationsAggregationRange = AggregationsUntypedAggregationRange | AggregationsDateAggregationRange | AggregationsNumberAggregationRange | AggregationsTermAggregationRange + +export interface AggregationsAggregationRangeBase { + from?: T key?: string - to?: double | null + to?: T } export interface AggregationsArrayPercentilesItem { @@ -3400,6 +3402,9 @@ export interface AggregationsCustomCategorizeTextAnalyzer { filter?: string[] } +export interface AggregationsDateAggregationRange extends AggregationsAggregationRangeBase { +} + export interface AggregationsDateHistogramAggregate extends AggregationsMultiBucketAggregateBase { } @@ -3435,17 +3440,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 @@ -3997,6 +3996,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 @@ -4321,6 +4323,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 @@ -4436,6 +4441,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 88c6238ca9..28ea96b3bc 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -295,7 +295,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. */ @@ -306,33 +306,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 -} - -/** - * @ext_doc_id search-aggregations-bucket-diversified-sampler-aggregation - */ export class DiversifiedSamplerAggregation extends BucketAggregationBase { /** * The type of value used for de-duplication. @@ -688,11 +661,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 | null + from?: T /** * Custom key to return the range with. */ @@ -700,12 +683,26 @@ export class AggregationRange { /** * End of the range (exclusive). */ - to?: double | null + to?: T } +export class NumberAggregationRange extends AggregationRangeBase {} + +export class TermAggregationRange extends AggregationRangeBase {} + +export class UntypedAggregationRange extends AggregationRangeBase {} + +export class DateAggregationRange extends AggregationRangeBase {} + /** - * @ext_doc_id search-aggregations-bucket-rare-terms-aggregation + * 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.