From f26ac6fe57c39d2ca88e092d664405d9fcd36f2c Mon Sep 17 00:00:00 2001 From: Pawan Kartik Date: Tue, 11 Feb 2025 13:56:12 +0000 Subject: [PATCH] Add missing `include_ccs_metadata` to ES|QL query endpoints (#3743) * Add missing `include_ccs_metadata` to ES|QL query endpoints * Address review comments * Regenerate output --------- Co-authored-by: lcawl (cherry picked from commit 6b15af9e6dfa7ee4f2d6e252b26dc68be0c97b7e) --- output/openapi/elasticsearch-openapi.json | 8 +++++ .../elasticsearch-serverless-openapi.json | 4 +++ output/schema/schema-serverless.json | 14 ++++++++- output/schema/schema.json | 30 +++++++++++++++++-- output/typescript/types.ts | 2 ++ .../esql/async_query/AsyncQueryRequest.ts | 7 +++++ .../request/AsyncQueryRequestExample1.yaml | 13 +++++++- specification/esql/query/QueryRequest.ts | 7 +++++ .../request/QueryRequestExample1.yaml | 5 ++-- 9 files changed, 84 insertions(+), 6 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index c8f116104e..f11c5de6e6 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -8838,6 +8838,10 @@ "$ref": "#/components/schemas/esql._types:TableValuesContainer" } } + }, + "include_ccs_metadata": { + "description": "When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters`\nobject with information about the clusters that participated in the search along with info such as shards\ncount.", + "type": "boolean" } }, "required": [ @@ -9101,6 +9105,10 @@ "$ref": "#/components/schemas/esql._types:TableValuesContainer" } } + }, + "include_ccs_metadata": { + "description": "When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters`\nobject with information about the clusters that participated in the search along with info such as shards\ncount.", + "type": "boolean" } }, "required": [ diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 5b5501fa1e..f5b5ca6b46 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -5255,6 +5255,10 @@ "$ref": "#/components/schemas/esql._types:TableValuesContainer" } } + }, + "include_ccs_metadata": { + "description": "When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters`\nobject with information about the clusters that participated in the search along with info such as shards\ncount.", + "type": "boolean" } }, "required": [ diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index e46b245ab2..2cfba6964d 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -18578,6 +18578,18 @@ } } } + }, + { + "description": "If provided and `true`, the response will include an extra `_clusters` object with information\nabout the clusters that participated in the search along with info such as shards count.", + "name": "include_ccs_metadata", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } } ] }, @@ -18633,7 +18645,7 @@ } } ], - "specLocation": "esql/query/QueryRequest.ts#L27-L98" + "specLocation": "esql/query/QueryRequest.ts#L27-L103" }, { "body": { diff --git a/output/schema/schema.json b/output/schema/schema.json index bce0f3a225..b41497f4ad 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -122217,6 +122217,19 @@ } } } + }, + { + "description": "When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters`\nobject with information about the clusters that participated in the search along with info such as shards\ncount.", + "name": "include_ccs_metadata", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } } ] }, @@ -122310,7 +122323,7 @@ } } ], - "specLocation": "esql/async_query/AsyncQueryRequest.ts#L28-L118" + "specLocation": "esql/async_query/AsyncQueryRequest.ts#L28-L125" }, { "kind": "response", @@ -122661,6 +122674,19 @@ } } } + }, + { + "description": "When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters`\nobject with information about the clusters that participated in the search along with info such as shards\ncount.", + "name": "include_ccs_metadata", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } } ] }, @@ -122715,7 +122741,7 @@ } } ], - "specLocation": "esql/query/QueryRequest.ts#L27-L98" + "specLocation": "esql/query/QueryRequest.ts#L27-L105" }, { "kind": "response", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 05c617b8a7..d5b76a9c09 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10557,6 +10557,7 @@ export interface EsqlAsyncQueryRequest extends RequestBase { profile?: boolean query: string tables?: Record> + include_ccs_metadata?: boolean } } @@ -10596,6 +10597,7 @@ export interface EsqlQueryRequest extends RequestBase { profile?: boolean query: string tables?: Record> + include_ccs_metadata?: boolean } } diff --git a/specification/esql/async_query/AsyncQueryRequest.ts b/specification/esql/async_query/AsyncQueryRequest.ts index 0f2ed505ed..12eb54b5dc 100644 --- a/specification/esql/async_query/AsyncQueryRequest.ts +++ b/specification/esql/async_query/AsyncQueryRequest.ts @@ -114,5 +114,12 @@ export interface Request extends RequestBase { * name and the next level key is the column name. */ tables?: Dictionary> + /** + * When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` + * object with information about the clusters that participated in the search along with info such as shards + * count. + * @server_default false + */ + include_ccs_metadata?: boolean } } diff --git a/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml b/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml index 1cafcc7712..968c685778 100644 --- a/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml +++ b/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml @@ -2,4 +2,15 @@ # method_request: "POST /_query/async" # description: # type: request -value: "{\n \"query\": \"\"\"\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n \"\"\",\n \"wait_for_completion_timeout\": \"2s\"\n}" +value: |- + { + "query": """ + FROM library,remote-*:library + | EVAL year = DATE_TRUNC(1 YEARS, release_date) + | STATS MAX(page_count) BY year + | SORT year + | LIMIT 5 + """, + "wait_for_completion_timeout": "2s", + "include_ccs_metadata": true + } diff --git a/specification/esql/query/QueryRequest.ts b/specification/esql/query/QueryRequest.ts index a9097b29b0..bce931aaac 100644 --- a/specification/esql/query/QueryRequest.ts +++ b/specification/esql/query/QueryRequest.ts @@ -94,5 +94,12 @@ export interface Request extends RequestBase { * name and the next level key is the column name. */ tables?: Dictionary> + /** + * When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` + * object with information about the clusters that participated in the search along with info such as shards + * count. + * @server_default false + */ + include_ccs_metadata?: boolean } } diff --git a/specification/esql/query/examples/request/QueryRequestExample1.yaml b/specification/esql/query/examples/request/QueryRequestExample1.yaml index e6167f7175..14cb30810d 100644 --- a/specification/esql/query/examples/request/QueryRequestExample1.yaml +++ b/specification/esql/query/examples/request/QueryRequestExample1.yaml @@ -5,10 +5,11 @@ description: Run `POST /_query` to get results for an ES|QL query. value: |- { "query": """ - FROM library + FROM library,remote-*:library | EVAL year = DATE_TRUNC(1 YEARS, release_date) | STATS MAX(page_count) BY year | SORT year | LIMIT 5 - """ + """, + "include_ccs_metadata": true }