From 0ea6b10204a745b1154950475141c3ed5e8e4cdf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 13:00:04 +0400 Subject: [PATCH] Add track_total_hits to search_mvt (#4850) (#4870) (cherry picked from commit 069159ff8c726f9131ffefafd702c09285065623) Co-authored-by: Quentin Pradet (cherry picked from commit 5c415dedc6c4d8941a1d6f378e434246d9ee3a41) # Conflicts: # output/schema/schema.json --- output/openapi/elasticsearch-openapi.json | 16 ++++++++++++++++ .../elasticsearch-serverless-openapi.json | 16 ++++++++++++++++ output/schema/schema.json | 15 ++++++++++++++- output/schema/validation-errors.json | 3 +-- output/typescript/types.ts | 1 + .../_global/search_mvt/SearchMvtRequest.ts | 7 +++++++ 6 files changed, 55 insertions(+), 3 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index cc223b38f2..dd0988dac0 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -32054,6 +32054,9 @@ { "$ref": "#/components/parameters/search_mvt-size" }, + { + "$ref": "#/components/parameters/search_mvt-track_total_hits" + }, { "$ref": "#/components/parameters/search_mvt-with_labels" } @@ -32112,6 +32115,9 @@ { "$ref": "#/components/parameters/search_mvt-size" }, + { + "$ref": "#/components/parameters/search_mvt-track_total_hits" + }, { "$ref": "#/components/parameters/search_mvt-with_labels" } @@ -115998,6 +116004,16 @@ }, "style": "form" }, + "search_mvt-track_total_hits": { + "in": "query", + "name": "track_total_hits", + "description": "The number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_global.search._types.TrackHits" + }, + "style": "form" + }, "search_mvt-with_labels": { "in": "query", "name": "with_labels", diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 604682383c..6614b739d5 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -19930,6 +19930,9 @@ { "$ref": "#/components/parameters/search_mvt-size" }, + { + "$ref": "#/components/parameters/search_mvt-track_total_hits" + }, { "$ref": "#/components/parameters/search_mvt-with_labels" } @@ -19988,6 +19991,9 @@ { "$ref": "#/components/parameters/search_mvt-size" }, + { + "$ref": "#/components/parameters/search_mvt-track_total_hits" + }, { "$ref": "#/components/parameters/search_mvt-with_labels" } @@ -69810,6 +69816,16 @@ }, "style": "form" }, + "search_mvt-track_total_hits": { + "in": "query", + "name": "track_total_hits", + "description": "The number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_global.search._types.TrackHits" + }, + "style": "form" + }, "search_mvt-with_labels": { "in": "query", "name": "with_labels", diff --git a/output/schema/schema.json b/output/schema/schema.json index cc8b00f6da..b72884ce19 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -44947,6 +44947,19 @@ } } }, + { + "description": "The number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.", + "name": "track_total_hits", + "required": false, + "serverDefault": "10000", + "type": { + "kind": "instance_of", + "type": { + "name": "TrackHits", + "namespace": "_global.search._types" + } + } + }, { "description": "If `true`, the hits and aggs layers will contain additional point features representing\nsuggested label positions for the original features.\n\n* `Point` and `MultiPoint` features will have one of the points selected.\n* `Polygon` and `MultiPolygon` features will have a single point generated, either the centroid, if it is within the polygon, or another point within the polygon selected from the sorted triangle-tree.\n* `LineString` features will likewise provide a roughly central point selected from the triangle-tree.\n* The aggregation results will provide one central point for each aggregation bucket.\n\nAll attributes from the original features will also be copied to the new label features.\nIn addition, the new features will be distinguishable using the tag `_mvt_label_position`.", "name": "with_labels", @@ -44960,7 +44973,7 @@ } } ], - "specLocation": "_global/search_mvt/SearchMvtRequest.ts#L33-L373" + "specLocation": "_global/search_mvt/SearchMvtRequest.ts#L33-L380" }, { "kind": "response", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index a44215f456..097e04c9ec 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -281,8 +281,7 @@ }, "search_mvt": { "request": [ - "Request: query parameter 'grid_agg' does not exist in the json spec", - "Request: missing json spec query parameter 'track_total_hits'" + "Request: query parameter 'grid_agg' does not exist in the json spec" ], "response": [] }, diff --git a/output/typescript/types.ts b/output/typescript/types.ts index d7b85ca5ba..58e9a7ade8 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -1868,6 +1868,7 @@ export interface SearchMvtRequest extends RequestBase { grid_precision?: integer grid_type?: SearchMvtGridType size?: integer + track_total_hits?: SearchTrackHits with_labels?: boolean body?: { aggs?: Record diff --git a/specification/_global/search_mvt/SearchMvtRequest.ts b/specification/_global/search_mvt/SearchMvtRequest.ts index aa7245aa2e..ad879324e2 100644 --- a/specification/_global/search_mvt/SearchMvtRequest.ts +++ b/specification/_global/search_mvt/SearchMvtRequest.ts @@ -246,6 +246,13 @@ export interface Request extends RequestBase { * @server_default 10000 */ size?: integer + /** + * The number of hits matching the query to count accurately. + * If `true`, the exact number of hits is returned at the cost of some performance. + * If `false`, the response does not include the total number of hits matching the query. + * @server_default 10000 + */ + track_total_hits?: TrackHits /** * If `true`, the hits and aggs layers will contain additional point features representing * suggested label positions for the original features.