From 42fae9f0dc788c74ed931564159894b5247c8920 Mon Sep 17 00:00:00 2001 From: Pawan Kartik Date: Thu, 6 Feb 2025 18:26:18 +0000 Subject: [PATCH 1/3] Add missing `include_ccs_metadata` to ES|QL query endpoints --- output/openapi/elasticsearch-openapi.json | 8 ++++++ .../elasticsearch-serverless-openapi.json | 4 +++ output/schema/schema-serverless.json | 14 +++++++++- output/schema/schema.json | 28 +++++++++++++++++-- output/typescript/types.ts | 2 ++ .../esql/async_query/AsyncQueryRequest.ts | 5 ++++ .../request/AsyncQueryRequestExample1.yaml | 13 ++++++++- specification/esql/query/QueryRequest.ts | 5 ++++ .../request/QueryRequestExample1.yaml | 5 ++-- 9 files changed, 78 insertions(+), 6 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 61a748631f..2a0a31ec67 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -8839,6 +8839,10 @@ "$ref": "#/components/schemas/esql._types:TableValuesContainer" } } + }, + "include_ccs_metadata": { + "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.", + "type": "boolean" } }, "required": [ @@ -9102,6 +9106,10 @@ "$ref": "#/components/schemas/esql._types:TableValuesContainer" } } + }, + "include_ccs_metadata": { + "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.", + "type": "boolean" } }, "required": [ diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index c1aabcce5d..972270d659 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": "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.", + "type": "boolean" } }, "required": [ diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 58c8bcf8f6..c685c75d2c 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 63fb409182..70335ed0f6 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -122351,6 +122351,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" + } + } } ] }, @@ -122444,7 +122456,7 @@ } } ], - "specLocation": "esql/async_query/AsyncQueryRequest.ts#L28-L118" + "specLocation": "esql/async_query/AsyncQueryRequest.ts#L28-L123" }, { "kind": "response", @@ -122795,6 +122807,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" + } + } } ] }, @@ -122849,7 +122873,7 @@ } } ], - "specLocation": "esql/query/QueryRequest.ts#L27-L98" + "specLocation": "esql/query/QueryRequest.ts#L27-L103" }, { "kind": "response", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 165d21b9d3..6711aede6f 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10554,6 +10554,7 @@ export interface EsqlAsyncQueryRequest extends RequestBase { profile?: boolean query: string tables?: Record> + include_ccs_metadata?: boolean } } @@ -10593,6 +10594,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..5a3c210f5c 100644 --- a/specification/esql/async_query/AsyncQueryRequest.ts +++ b/specification/esql/async_query/AsyncQueryRequest.ts @@ -114,5 +114,10 @@ export interface Request extends RequestBase { * name and the next level key is the column name. */ tables?: Dictionary> + /** + * If provided and `true`, 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. + */ + 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..ff0a5ab797 100644 --- a/specification/esql/query/QueryRequest.ts +++ b/specification/esql/query/QueryRequest.ts @@ -94,5 +94,10 @@ export interface Request extends RequestBase { * name and the next level key is the column name. */ tables?: Dictionary> + /** + * If provided and `true`, 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. + */ + 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 } From 8346989893e274bbcba3b6f234059936d435e199 Mon Sep 17 00:00:00 2001 From: Pawan Kartik Date: Fri, 7 Feb 2025 19:10:12 +0000 Subject: [PATCH 2/3] Address review comments --- specification/esql/async_query/AsyncQueryRequest.ts | 6 ++++-- specification/esql/query/QueryRequest.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/specification/esql/async_query/AsyncQueryRequest.ts b/specification/esql/async_query/AsyncQueryRequest.ts index 5a3c210f5c..12eb54b5dc 100644 --- a/specification/esql/async_query/AsyncQueryRequest.ts +++ b/specification/esql/async_query/AsyncQueryRequest.ts @@ -115,8 +115,10 @@ export interface Request extends RequestBase { */ tables?: Dictionary> /** - * If provided and `true`, 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. + * 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/QueryRequest.ts b/specification/esql/query/QueryRequest.ts index ff0a5ab797..bce931aaac 100644 --- a/specification/esql/query/QueryRequest.ts +++ b/specification/esql/query/QueryRequest.ts @@ -95,8 +95,10 @@ export interface Request extends RequestBase { */ tables?: Dictionary> /** - * If provided and `true`, 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. + * 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 } From fb5c06a5c3d167276ce6c9863ef377e3c9194633 Mon Sep 17 00:00:00 2001 From: lcawl Date: Mon, 10 Feb 2025 08:11:13 -0800 Subject: [PATCH 3/3] Regenerate output --- output/openapi/elasticsearch-openapi.json | 4 ++-- output/openapi/elasticsearch-serverless-openapi.json | 2 +- output/schema/schema.json | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 2a0a31ec67..6188a1e9b3 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -8841,7 +8841,7 @@ } }, "include_ccs_metadata": { - "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.", + "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" } }, @@ -9108,7 +9108,7 @@ } }, "include_ccs_metadata": { - "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.", + "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" } }, diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 972270d659..d4f4f3c385 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -5257,7 +5257,7 @@ } }, "include_ccs_metadata": { - "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.", + "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" } }, diff --git a/output/schema/schema.json b/output/schema/schema.json index 70335ed0f6..fd5e7db6ca 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -122353,9 +122353,10 @@ } }, { - "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.", + "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": { @@ -122456,7 +122457,7 @@ } } ], - "specLocation": "esql/async_query/AsyncQueryRequest.ts#L28-L123" + "specLocation": "esql/async_query/AsyncQueryRequest.ts#L28-L125" }, { "kind": "response", @@ -122809,9 +122810,10 @@ } }, { - "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.", + "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": { @@ -122873,7 +122875,7 @@ } } ], - "specLocation": "esql/query/QueryRequest.ts#L27-L103" + "specLocation": "esql/query/QueryRequest.ts#L27-L105" }, { "kind": "response",