From 42ca029e79c94baf21b09dbcc6bb98d37f461ac1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 10:00:15 +0100 Subject: [PATCH] geo_grid (#3860) (#3868) (cherry picked from commit 5b9a58f8c4ed77a65cd85372e383774745caed52) Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com> --- output/openapi/elasticsearch-openapi.json | 32 ++++ .../elasticsearch-serverless-openapi.json | 32 ++++ output/schema/schema-serverless.json | 171 +++++++++++++----- output/schema/schema.json | 107 +++++++++-- output/typescript/types.ts | 7 + .../_types/query_dsl/abstractions.ts | 6 + specification/_types/query_dsl/geo.ts | 12 +- 7 files changed, 302 insertions(+), 65 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index fa47c553e5..58d811bf4a 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -45057,6 +45057,15 @@ "geo_distance": { "$ref": "#/components/schemas/_types.query_dsl:GeoDistanceQuery" }, + "geo_grid": { + "description": "Matches `geo_point` and `geo_shape` values that intersect a grid cell from a GeoGrid aggregation.", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/_types.query_dsl:GeoGridQuery" + }, + "minProperties": 1, + "maxProperties": 1 + }, "geo_polygon": { "$ref": "#/components/schemas/_types.query_dsl:GeoPolygonQuery" }, @@ -46172,6 +46181,29 @@ "plane" ] }, + "_types.query_dsl:GeoGridQuery": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.query_dsl:QueryBase" + }, + { + "type": "object", + "properties": { + "geogrid": { + "$ref": "#/components/schemas/_types:GeoTile" + }, + "geohash": { + "$ref": "#/components/schemas/_types:GeoHash" + }, + "geohex": { + "$ref": "#/components/schemas/_types:GeoHexCell" + } + }, + "minProperties": 1, + "maxProperties": 1 + } + ] + }, "_types.query_dsl:GeoPolygonQuery": { "allOf": [ { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 5cecf1950e..612ee69357 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -25885,6 +25885,15 @@ "geo_distance": { "$ref": "#/components/schemas/_types.query_dsl:GeoDistanceQuery" }, + "geo_grid": { + "description": "Matches `geo_point` and `geo_shape` values that intersect a grid cell from a GeoGrid aggregation.", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/_types.query_dsl:GeoGridQuery" + }, + "minProperties": 1, + "maxProperties": 1 + }, "geo_polygon": { "$ref": "#/components/schemas/_types.query_dsl:GeoPolygonQuery" }, @@ -27000,6 +27009,29 @@ "plane" ] }, + "_types.query_dsl:GeoGridQuery": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.query_dsl:QueryBase" + }, + { + "type": "object", + "properties": { + "geogrid": { + "$ref": "#/components/schemas/_types:GeoTile" + }, + "geohash": { + "$ref": "#/components/schemas/_types:GeoHash" + }, + "geohex": { + "$ref": "#/components/schemas/_types:GeoHexCell" + } + }, + "minProperties": 1, + "maxProperties": 1 + } + ] + }, "_types.query_dsl:GeoPolygonQuery": { "allOf": [ { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 317345fb4a..ee6be1da60 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -48436,6 +48436,29 @@ } } }, + { + "description": "Matches `geo_point` and `geo_shape` values that intersect a grid cell from a GeoGrid aggregation.", + "name": "geo_grid", + "required": false, + "type": { + "key": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + "kind": "dictionary_of", + "singleKey": true, + "value": { + "kind": "instance_of", + "type": { + "name": "GeoGridQuery", + "namespace": "_types.query_dsl" + } + } + } + }, { "deprecation": { "description": "Use geo-shape instead.", @@ -49292,7 +49315,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L102-L428", + "specLocation": "_types/query_dsl/abstractions.ts#L103-L434", "variants": { "kind": "container", "nonExhaustive": true @@ -49471,7 +49494,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L453-L464" + "specLocation": "_types/query_dsl/abstractions.ts#L459-L470" }, { "kind": "type_alias", @@ -49817,7 +49840,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L466-L500" + "specLocation": "_types/query_dsl/abstractions.ts#L472-L506" }, { "kind": "enum", @@ -49833,7 +49856,7 @@ "name": "CombinedFieldsOperator", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/abstractions.ts#L513-L516" + "specLocation": "_types/query_dsl/abstractions.ts#L519-L522" }, { "kind": "enum", @@ -49851,7 +49874,7 @@ "name": "CombinedFieldsZeroTerms", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/abstractions.ts#L518-L527" + "specLocation": "_types/query_dsl/abstractions.ts#L524-L533" }, { "extDocId": "query-dsl-constant-score-query", @@ -51349,7 +51372,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L32-L54" + "specLocation": "_types/query_dsl/geo.ts#L35-L57" }, { "codegenNames": [ @@ -51673,7 +51696,7 @@ "name": "GeoExecution", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/geo.ts#L56-L59" + "specLocation": "_types/query_dsl/geo.ts#L59-L62" }, { "kind": "enum", @@ -51694,7 +51717,7 @@ "name": "GeoValidationMethod", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/geo.ts#L163-L173" + "specLocation": "_types/query_dsl/geo.ts#L173-L183" }, { "attachedBehaviors": [ @@ -51796,7 +51819,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L61-L93" + "specLocation": "_types/query_dsl/geo.ts#L64-L96" }, { "kind": "type_alias", @@ -51831,6 +51854,90 @@ }, "specLocation": "_types/Geo.ts#L42-L51" }, + { + "inherits": { + "type": { + "name": "QueryBase", + "namespace": "_types.query_dsl" + } + }, + "kind": "interface", + "name": { + "name": "GeoGridQuery", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "name": "geogrid", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoTile", + "namespace": "_types" + } + } + }, + { + "name": "geohash", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoHash", + "namespace": "_types" + } + } + }, + { + "name": "geohex", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoHexCell", + "namespace": "_types" + } + } + } + ], + "specLocation": "_types/query_dsl/geo.ts#L98-L103", + "variants": { + "kind": "container" + } + }, + { + "description": "A map tile reference, represented as `{zoom}/{x}/{y}`", + "kind": "type_alias", + "name": { + "name": "GeoTile", + "namespace": "_types" + }, + "specLocation": "_types/Geo.ts#L93-L94", + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "A map hex cell (H3) reference", + "kind": "type_alias", + "name": { + "name": "GeoHexCell", + "namespace": "_types" + }, + "specLocation": "_types/Geo.ts#L96-L97", + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, { "attachedBehaviors": [ "AdditionalProperty" @@ -51905,7 +52012,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L99-L111" + "specLocation": "_types/query_dsl/geo.ts#L109-L121" }, { "kind": "interface", @@ -51929,7 +52036,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L95-L97" + "specLocation": "_types/query_dsl/geo.ts#L105-L107" }, { "attachedBehaviors": [ @@ -51991,7 +52098,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L131-L147" + "specLocation": "_types/query_dsl/geo.ts#L141-L157" }, { "kind": "interface", @@ -52037,7 +52144,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L118-L129" + "specLocation": "_types/query_dsl/geo.ts#L128-L139" }, { "description": "A GeoJson shape, that can also use Elasticsearch's `envelope` extension.", @@ -52107,7 +52214,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L430-L447" + "specLocation": "_types/query_dsl/abstractions.ts#L436-L453" }, { "kind": "enum", @@ -52582,7 +52689,7 @@ } ], "shortcutProperty": "field", - "specLocation": "_types/query_dsl/abstractions.ts#L529-L543" + "specLocation": "_types/query_dsl/abstractions.ts#L535-L549" }, { "inherits": { @@ -59626,7 +59733,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L502-L511" + "specLocation": "_types/query_dsl/abstractions.ts#L508-L517" }, { "inherits": { @@ -77620,38 +77727,6 @@ } } }, - { - "description": "A map hex cell (H3) reference", - "kind": "type_alias", - "name": { - "name": "GeoHexCell", - "namespace": "_types" - }, - "specLocation": "_types/Geo.ts#L96-L97", - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "description": "A map tile reference, represented as `{zoom}/{x}/{y}`", - "kind": "type_alias", - "name": { - "name": "GeoTile", - "namespace": "_types" - }, - "specLocation": "_types/Geo.ts#L93-L94", - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, { "kind": "type_alias", "name": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 8fd7e0e3d1..9db7431c6b 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -80306,7 +80306,7 @@ "name": "CombinedFieldsOperator", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/abstractions.ts#L513-L516" + "specLocation": "_types/query_dsl/abstractions.ts#L519-L522" }, { "kind": "interface", @@ -80402,7 +80402,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L466-L500" + "specLocation": "_types/query_dsl/abstractions.ts#L472-L506" }, { "kind": "enum", @@ -80420,7 +80420,7 @@ "name": "CombinedFieldsZeroTerms", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/abstractions.ts#L518-L527" + "specLocation": "_types/query_dsl/abstractions.ts#L524-L533" }, { "kind": "interface", @@ -81084,7 +81084,7 @@ } ], "shortcutProperty": "field", - "specLocation": "_types/query_dsl/abstractions.ts#L529-L543" + "specLocation": "_types/query_dsl/abstractions.ts#L535-L549" }, { "kind": "interface", @@ -81142,7 +81142,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L430-L447" + "specLocation": "_types/query_dsl/abstractions.ts#L436-L453" }, { "kind": "enum", @@ -81733,7 +81733,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L32-L54" + "specLocation": "_types/query_dsl/geo.ts#L35-L57" }, { "kind": "interface", @@ -81900,7 +81900,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L61-L93" + "specLocation": "_types/query_dsl/geo.ts#L64-L96" }, { "kind": "enum", @@ -81916,7 +81916,59 @@ "name": "GeoExecution", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/geo.ts#L56-L59" + "specLocation": "_types/query_dsl/geo.ts#L59-L62" + }, + { + "kind": "interface", + "inherits": { + "type": { + "name": "QueryBase", + "namespace": "_types.query_dsl" + } + }, + "name": { + "name": "GeoGridQuery", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "name": "geogrid", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoTile", + "namespace": "_types" + } + } + }, + { + "name": "geohash", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoHash", + "namespace": "_types" + } + } + }, + { + "name": "geohex", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoHexCell", + "namespace": "_types" + } + } + } + ], + "specLocation": "_types/query_dsl/geo.ts#L98-L103", + "variants": { + "kind": "container" + } }, { "kind": "interface", @@ -81940,7 +81992,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L95-L97" + "specLocation": "_types/query_dsl/geo.ts#L105-L107" }, { "kind": "interface", @@ -82016,7 +82068,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L99-L111" + "specLocation": "_types/query_dsl/geo.ts#L109-L121" }, { "kind": "interface", @@ -82062,7 +82114,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L118-L129" + "specLocation": "_types/query_dsl/geo.ts#L128-L139" }, { "kind": "interface", @@ -82124,7 +82176,7 @@ } } ], - "specLocation": "_types/query_dsl/geo.ts#L131-L147" + "specLocation": "_types/query_dsl/geo.ts#L141-L157" }, { "kind": "enum", @@ -82145,7 +82197,7 @@ "name": "GeoValidationMethod", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/geo.ts#L163-L173" + "specLocation": "_types/query_dsl/geo.ts#L173-L183" }, { "kind": "interface", @@ -84799,7 +84851,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L453-L464" + "specLocation": "_types/query_dsl/abstractions.ts#L459-L470" }, { "kind": "interface", @@ -85008,6 +85060,29 @@ } } }, + { + "description": "Matches `geo_point` and `geo_shape` values that intersect a grid cell from a GeoGrid aggregation.", + "name": "geo_grid", + "required": false, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + "singleKey": true, + "value": { + "kind": "instance_of", + "type": { + "name": "GeoGridQuery", + "namespace": "_types.query_dsl" + } + } + } + }, { "deprecation": { "description": "Use geo-shape instead.", @@ -85864,7 +85939,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L102-L428", + "specLocation": "_types/query_dsl/abstractions.ts#L103-L434", "variants": { "kind": "container", "nonExhaustive": true @@ -88746,7 +88821,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L502-L511" + "specLocation": "_types/query_dsl/abstractions.ts#L508-L517" }, { "kind": "enum", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index bab8368128..0fe82cafc8 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -6058,6 +6058,12 @@ export type QueryDslGeoDistanceQuery = QueryDslGeoDistanceQueryKeys export type QueryDslGeoExecution = 'memory' | 'indexed' +export interface QueryDslGeoGridQuery extends QueryDslQueryBase { + geogrid?: GeoTile + geohash?: GeoHash + geohex?: GeoHexCell +} + export interface QueryDslGeoPolygonPoints { points: GeoLocation[] } @@ -6353,6 +6359,7 @@ export interface QueryDslQueryContainer { fuzzy?: Partial> geo_bounding_box?: QueryDslGeoBoundingBoxQuery geo_distance?: QueryDslGeoDistanceQuery + geo_grid?: Partial> geo_polygon?: QueryDslGeoPolygonQuery geo_shape?: QueryDslGeoShapeQuery has_child?: QueryDslHasChildQuery diff --git a/specification/_types/query_dsl/abstractions.ts b/specification/_types/query_dsl/abstractions.ts index 9c7c3767dc..1a560f79a2 100644 --- a/specification/_types/query_dsl/abstractions.ts +++ b/specification/_types/query_dsl/abstractions.ts @@ -48,6 +48,7 @@ import { import { GeoBoundingBoxQuery, GeoDistanceQuery, + GeoGridQuery, GeoPolygonQuery, GeoShapeQuery } from './geo' @@ -167,6 +168,11 @@ export class QueryContainer { * @ext_doc_id query-dsl-geo-distance-query */ geo_distance?: GeoDistanceQuery + + /** + * Matches `geo_point` and `geo_shape` values that intersect a grid cell from a GeoGrid aggregation. + */ + geo_grid?: SingleKeyDictionary /** * @deprecated 7.12.0 Use geo-shape instead. */ diff --git a/specification/_types/query_dsl/geo.ts b/specification/_types/query_dsl/geo.ts index e78d9d5fdf..d73e6327e3 100644 --- a/specification/_types/query_dsl/geo.ts +++ b/specification/_types/query_dsl/geo.ts @@ -23,9 +23,12 @@ import { Distance, GeoBounds, GeoDistanceType, + GeoHash, + GeoHexCell, GeoLocation, GeoShape, - GeoShapeRelation + GeoShapeRelation, + GeoTile } from '@_types/Geo' import { FieldLookup, QueryBase } from './abstractions' @@ -92,6 +95,13 @@ export class GeoDistanceQuery ignore_unmapped?: boolean } +/** @variants container */ +export class GeoGridQuery extends QueryBase { + geogrid?: GeoTile + geohash?: GeoHash + geohex?: GeoHexCell +} + export class GeoPolygonPoints { points: GeoLocation[] }