From bd2bc4067ae215fbc48bdf011df944ae30b61efe Mon Sep 17 00:00:00 2001 From: Gal Lalouche Date: Thu, 10 Apr 2025 20:10:44 +0300 Subject: [PATCH 1/8] ESQL: Add query monitoring API --- specification/esql/queries/GetQueryRequest.ts | 40 +++++++++++++++++++ .../esql/queries/GetQueryResponse.ts | 33 +++++++++++++++ .../esql/queries/ListQueriesRequest.ts | 36 +++++++++++++++++ .../esql/queries/ListQueriesResponse.ts | 33 +++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 specification/esql/queries/GetQueryRequest.ts create mode 100644 specification/esql/queries/GetQueryResponse.ts create mode 100644 specification/esql/queries/ListQueriesRequest.ts create mode 100644 specification/esql/queries/ListQueriesResponse.ts diff --git a/specification/esql/queries/GetQueryRequest.ts b/specification/esql/queries/GetQueryRequest.ts new file mode 100644 index 0000000000..2ac0f8c88f --- /dev/null +++ b/specification/esql/queries/GetQueryRequest.ts @@ -0,0 +1,40 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { Id } from '@_types/common' + +/** + * Get a specific running ES|QL query information. + * Returns an object extended information about a running ES|QL query. + * + * @rest_spec_name esql.get_query + * @index_previleges monitor_esql + */ +export interface GetQueryRequest extends RequestBase { + urls: [ + { + path: '/_query/queries/{query_task_id}' + methods: ['GET'] + } + ] + path_parts: { + query_task_id: Id + } +} diff --git a/specification/esql/queries/GetQueryResponse.ts b/specification/esql/queries/GetQueryResponse.ts new file mode 100644 index 0000000000..51a9f6facf --- /dev/null +++ b/specification/esql/queries/GetQueryResponse.ts @@ -0,0 +1,33 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { NodeId, TaskId } from '@_types/common' +import { long } from '@_types/Numeric' + +export class GetQueryResponse { + body: { + id: long + node: NodeId + start_time_millis: long + running_time_nanos: long + query: string + coordinating_node: NodeId + data_nodes: NodeId[] + } +} diff --git a/specification/esql/queries/ListQueriesRequest.ts b/specification/esql/queries/ListQueriesRequest.ts new file mode 100644 index 0000000000..e5351e13b5 --- /dev/null +++ b/specification/esql/queries/ListQueriesRequest.ts @@ -0,0 +1,36 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' + +/** + * Get running ES|QL queries information. + * Returns an object containing IDs and other information about the running ES|QL queries. + + * @rest_spec_name esql.list_queries + * @index_previleges monitor_esql + */ +export interface ListQueryRequest extends RequestBase { + urls: [ + { + path: '/_query/queries' + methods: ['GET'] + } + ] +} diff --git a/specification/esql/queries/ListQueriesResponse.ts b/specification/esql/queries/ListQueriesResponse.ts new file mode 100644 index 0000000000..f08fafb5ea --- /dev/null +++ b/specification/esql/queries/ListQueriesResponse.ts @@ -0,0 +1,33 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { NodeId, TaskId } from '@_types/common' +import { long } from '@_types/Numeric' + +export class ListQueryResponse { + body: { + queries: Record + } +} From 6e0d430286dc59656fc30d42c176abd86f3990bb Mon Sep 17 00:00:00 2001 From: Gal Lalouche Date: Thu, 10 Apr 2025 20:32:44 +0300 Subject: [PATCH 2/8] Fix names, move folders --- specification/esql/{queries => get_query}/GetQueryRequest.ts | 2 +- specification/esql/{queries => get_query}/GetQueryResponse.ts | 2 +- .../esql/{queries => list_queries}/ListQueriesRequest.ts | 2 +- .../esql/{queries => list_queries}/ListQueriesResponse.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename specification/esql/{queries => get_query}/GetQueryRequest.ts (95%) rename specification/esql/{queries => get_query}/GetQueryResponse.ts (97%) rename specification/esql/{queries => list_queries}/ListQueriesRequest.ts (95%) rename specification/esql/{queries => list_queries}/ListQueriesResponse.ts (96%) diff --git a/specification/esql/queries/GetQueryRequest.ts b/specification/esql/get_query/GetQueryRequest.ts similarity index 95% rename from specification/esql/queries/GetQueryRequest.ts rename to specification/esql/get_query/GetQueryRequest.ts index 2ac0f8c88f..534cd1fdbd 100644 --- a/specification/esql/queries/GetQueryRequest.ts +++ b/specification/esql/get_query/GetQueryRequest.ts @@ -27,7 +27,7 @@ import { Id } from '@_types/common' * @rest_spec_name esql.get_query * @index_previleges monitor_esql */ -export interface GetQueryRequest extends RequestBase { +export interface Request extends RequestBase { urls: [ { path: '/_query/queries/{query_task_id}' diff --git a/specification/esql/queries/GetQueryResponse.ts b/specification/esql/get_query/GetQueryResponse.ts similarity index 97% rename from specification/esql/queries/GetQueryResponse.ts rename to specification/esql/get_query/GetQueryResponse.ts index 51a9f6facf..ba27c70efe 100644 --- a/specification/esql/queries/GetQueryResponse.ts +++ b/specification/esql/get_query/GetQueryResponse.ts @@ -20,7 +20,7 @@ import { NodeId, TaskId } from '@_types/common' import { long } from '@_types/Numeric' -export class GetQueryResponse { +export class Response { body: { id: long node: NodeId diff --git a/specification/esql/queries/ListQueriesRequest.ts b/specification/esql/list_queries/ListQueriesRequest.ts similarity index 95% rename from specification/esql/queries/ListQueriesRequest.ts rename to specification/esql/list_queries/ListQueriesRequest.ts index e5351e13b5..71460b2b75 100644 --- a/specification/esql/queries/ListQueriesRequest.ts +++ b/specification/esql/list_queries/ListQueriesRequest.ts @@ -26,7 +26,7 @@ import { RequestBase } from '@_types/Base' * @rest_spec_name esql.list_queries * @index_previleges monitor_esql */ -export interface ListQueryRequest extends RequestBase { +export interface Request extends RequestBase { urls: [ { path: '/_query/queries' diff --git a/specification/esql/queries/ListQueriesResponse.ts b/specification/esql/list_queries/ListQueriesResponse.ts similarity index 96% rename from specification/esql/queries/ListQueriesResponse.ts rename to specification/esql/list_queries/ListQueriesResponse.ts index f08fafb5ea..7b1639cd5f 100644 --- a/specification/esql/queries/ListQueriesResponse.ts +++ b/specification/esql/list_queries/ListQueriesResponse.ts @@ -20,7 +20,7 @@ import { NodeId, TaskId } from '@_types/common' import { long } from '@_types/Numeric' -export class ListQueryResponse { +export class Response { body: { queries: Record Date: Thu, 10 Apr 2025 20:41:00 +0300 Subject: [PATCH 3/8] Apply prettier --- .../esql/list_queries/ListQueriesResponse.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/specification/esql/list_queries/ListQueriesResponse.ts b/specification/esql/list_queries/ListQueriesResponse.ts index 7b1639cd5f..1c77322e6b 100644 --- a/specification/esql/list_queries/ListQueriesResponse.ts +++ b/specification/esql/list_queries/ListQueriesResponse.ts @@ -22,12 +22,15 @@ import { long } from '@_types/Numeric' export class Response { body: { - queries: Record + queries: Record< + TaskId, + { + id: long + node: NodeId + start_time_millis: long + running_time_nanos: long + query: string + } + > } } From 2b954f49bc8fa7b4ec49dbaf331486972c44cdcf Mon Sep 17 00:00:00 2001 From: Gal Lalouche Date: Thu, 10 Apr 2025 20:47:26 +0300 Subject: [PATCH 4/8] Replace TypeLiteral with another class --- .../esql/list_queries/ListQueriesResponse.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/specification/esql/list_queries/ListQueriesResponse.ts b/specification/esql/list_queries/ListQueriesResponse.ts index 1c77322e6b..d4659a5010 100644 --- a/specification/esql/list_queries/ListQueriesResponse.ts +++ b/specification/esql/list_queries/ListQueriesResponse.ts @@ -20,17 +20,16 @@ import { NodeId, TaskId } from '@_types/common' import { long } from '@_types/Numeric' +export class Body { + id: long + node: NodeId + start_time_millis: long + running_time_nanos: long + query: string +} + export class Response { body: { - queries: Record< - TaskId, - { - id: long - node: NodeId - start_time_millis: long - running_time_nanos: long - query: string - } - > + queries: Record } } From eb2068c17f842490439b0f70aa71fc6920a96603 Mon Sep 17 00:00:00 2001 From: Gal Lalouche Date: Thu, 10 Apr 2025 21:00:47 +0300 Subject: [PATCH 5/8] Fix unused import --- specification/esql/get_query/GetQueryResponse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/esql/get_query/GetQueryResponse.ts b/specification/esql/get_query/GetQueryResponse.ts index ba27c70efe..93e3104825 100644 --- a/specification/esql/get_query/GetQueryResponse.ts +++ b/specification/esql/get_query/GetQueryResponse.ts @@ -17,7 +17,7 @@ * under the License. */ -import { NodeId, TaskId } from '@_types/common' +import { NodeId } from '@_types/common' import { long } from '@_types/Numeric' export class Response { From 91e48295571be75591a4d70c1f850f76d36b9c63 Mon Sep 17 00:00:00 2001 From: Gal Lalouche Date: Thu, 10 Apr 2025 21:34:08 +0300 Subject: [PATCH 6/8] Fixes after running it manually --- compiler/src/model/utils.ts | 2 +- output/schema/schema.json | 326 ++++++++++++++++-- output/typescript/types.ts | 2 +- .../esql/get_query/GetQueryRequest.ts | 6 +- .../esql/list_queries/ListQueriesRequest.ts | 2 +- .../esql/list_queries/ListQueriesResponse.ts | 3 +- specification/security/_types/Privileges.ts | 2 + 7 files changed, 313 insertions(+), 30 deletions(-) diff --git a/compiler/src/model/utils.ts b/compiler/src/model/utils.ts index 886c96b0fd..fab2aaabce 100644 --- a/compiler/src/model/utils.ts +++ b/compiler/src/model/utils.ts @@ -679,7 +679,7 @@ export function hoistRequestAnnotations ( 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_inference', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_search_application', 'manage_search_query_rules', 'manage_search_synonyms', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', - 'manage_watcher', 'monitor', 'monitor_inference', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', + 'manage_watcher', 'monitor', 'monitor_esql', 'monitor_inference', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_security', 'read_slm', 'transport_client' ] const values = parseCommaSeparated(value) diff --git a/output/schema/schema.json b/output/schema/schema.json index 4ca015748b..3e4424e359 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -5075,15 +5075,26 @@ "visibility": "public" } }, - "description": "Executes a get ESQL query request", + "description": "Get a specific running ES|QL query information.\nReturns an object extended information about a running ES|QL query.", "docUrl": null, "name": "esql.get_query", - "request": null, + "privileges": { + "cluster": [ + "monitor_esql" + ] + }, + "request": { + "name": "Request", + "namespace": "esql.get_query" + }, "requestBodyRequired": false, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "esql.get_query" + }, "responseMediaType": [], "urls": [ { @@ -5101,15 +5112,26 @@ "visibility": "public" } }, - "description": "Executes a list ESQL queries request", + "description": "Get running ES|QL queries information.\nReturns an object containing IDs and other information about the running ES|QL queries.", "docUrl": null, "name": "esql.list_queries", - "request": null, + "privileges": { + "cluster": [ + "monitor_esql" + ] + }, + "request": { + "name": "Request", + "namespace": "esql.list_queries" + }, "requestBodyRequired": false, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "esql.list_queries" + }, "responseMediaType": [], "urls": [ { @@ -126373,6 +126395,258 @@ }, "specLocation": "esql/async_query_stop/AsyncQueryStopResponse.ts#L22-L25" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Get a specific running ES|QL query information.\nReturns an object extended information about a running ES|QL query.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "esql.get_query" + }, + "path": [ + { + "description": "The query ID", + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + } + ], + "query": [], + "specLocation": "esql/get_query/GetQueryRequest.ts#L23-L40" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "name": "node", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "NodeId", + "namespace": "_types" + } + } + }, + { + "name": "start_time_millis", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "name": "running_time_nanos", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "name": "query", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "coordinating_node", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "NodeId", + "namespace": "_types" + } + } + }, + { + "name": "data_nodes", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "NodeId", + "namespace": "_types" + } + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "esql.get_query" + }, + "specLocation": "esql/get_query/GetQueryResponse.ts#L23-L33" + }, + { + "kind": "interface", + "name": { + "name": "Body", + "namespace": "esql.list_queries" + }, + "properties": [ + { + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "name": "node", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "NodeId", + "namespace": "_types" + } + } + }, + { + "name": "start_time_millis", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "name": "running_time_nanos", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "name": "query", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "esql/list_queries/ListQueriesResponse.ts#L24-L30" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Get running ES|QL queries information.\nReturns an object containing IDs and other information about the running ES|QL queries.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "esql.list_queries" + }, + "path": [], + "query": [], + "specLocation": "esql/list_queries/ListQueriesRequest.ts#L22-L36" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "queries", + "required": true, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "TaskId", + "namespace": "_types" + } + }, + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "Body", + "namespace": "esql.list_queries" + } + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "esql.list_queries" + }, + "specLocation": "esql/list_queries/ListQueriesResponse.ts#L32-L36" + }, { "kind": "request", "attachedBehaviors": [ @@ -205080,7 +205354,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L434-L436" + "specLocation": "security/_types/Privileges.ts#L436-L438" }, { "kind": "interface", @@ -205276,6 +205550,9 @@ { "name": "manage_enrich" }, + { + "name": "manage_esql" + }, { "availability": { "stack": {} @@ -205384,6 +205661,9 @@ { "name": "monitor_enrich" }, + { + "name": "monitor_esql" + }, { "name": "monitor_inference" }, @@ -205484,7 +205764,7 @@ "name": "ClusterPrivilege", "namespace": "security._types" }, - "specLocation": "security/_types/Privileges.ts#L42-L199" + "specLocation": "security/_types/Privileges.ts#L42-L201" }, { "kind": "interface", @@ -205558,7 +205838,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L430-L432" + "specLocation": "security/_types/Privileges.ts#L432-L434" }, { "kind": "enum", @@ -205671,7 +205951,7 @@ "name": "IndexPrivilege", "namespace": "security._types" }, - "specLocation": "security/_types/Privileges.ts#L386-L428" + "specLocation": "security/_types/Privileges.ts#L388-L430" }, { "kind": "interface", @@ -205765,7 +206045,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L216-L242" + "specLocation": "security/_types/Privileges.ts#L218-L244" }, { "kind": "type_alias", @@ -205779,7 +206059,7 @@ "name": "IndicesPrivilegesQuery", "namespace": "security._types" }, - "specLocation": "security/_types/Privileges.ts#L341-L349", + "specLocation": "security/_types/Privileges.ts#L343-L351", "type": { "kind": "union_of", "items": [ @@ -205829,7 +206109,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L438-L440" + "specLocation": "security/_types/Privileges.ts#L440-L442" }, { "kind": "interface", @@ -205887,7 +206167,7 @@ "name": "RemoteClusterPrivilege", "namespace": "security._types" }, - "specLocation": "security/_types/Privileges.ts#L201-L213" + "specLocation": "security/_types/Privileges.ts#L203-L215" }, { "kind": "interface", @@ -205925,7 +206205,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L278-L290" + "specLocation": "security/_types/Privileges.ts#L280-L292" }, { "kind": "interface", @@ -206032,7 +206312,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L244-L276" + "specLocation": "security/_types/Privileges.ts#L246-L278" }, { "kind": "interface", @@ -206142,7 +206422,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L316-L339" + "specLocation": "security/_types/Privileges.ts#L318-L341" }, { "kind": "interface", @@ -206192,7 +206472,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L442-L452" + "specLocation": "security/_types/Privileges.ts#L444-L454" }, { "kind": "interface", @@ -206855,7 +207135,7 @@ "name": "RoleTemplateInlineQuery", "namespace": "security._types" }, - "specLocation": "security/_types/Privileges.ts#L383-L384", + "specLocation": "security/_types/Privileges.ts#L385-L386", "type": { "kind": "union_of", "items": [ @@ -206898,7 +207178,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L351-L361" + "specLocation": "security/_types/Privileges.ts#L353-L363" }, { "kind": "interface", @@ -206986,7 +207266,7 @@ } ], "shortcutProperty": "source", - "specLocation": "security/_types/Privileges.ts#L363-L381" + "specLocation": "security/_types/Privileges.ts#L365-L383" }, { "kind": "interface", @@ -207065,7 +207345,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L454-L474" + "specLocation": "security/_types/Privileges.ts#L456-L476" }, { "kind": "interface", @@ -207312,7 +207592,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L292-L314" + "specLocation": "security/_types/Privileges.ts#L294-L316" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 139759c703..6bc70cd152 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -18899,7 +18899,7 @@ export interface SecurityClusterNode { name: Name } -export type SecurityClusterPrivilege = 'all' | 'cancel_task' | 'create_snapshot' | 'cross_cluster_replication' | 'cross_cluster_search' | 'delegate_pki' | 'grant_api_key' | 'manage' | 'manage_api_key' | 'manage_autoscaling' | 'manage_behavioral_analytics' | 'manage_ccr' | 'manage_data_frame_transforms' | 'manage_data_stream_global_retention' | 'manage_enrich' | 'manage_ilm' | 'manage_index_templates' | 'manage_inference' | 'manage_ingest_pipelines' | 'manage_logstash_pipelines' | 'manage_ml' | 'manage_oidc' | 'manage_own_api_key' | 'manage_pipeline' | 'manage_rollup' | 'manage_saml' | 'manage_search_application' | 'manage_search_query_rules' | 'manage_search_synonyms' | 'manage_security' | 'manage_service_account' | 'manage_slm' | 'manage_token' | 'manage_transform' | 'manage_user_profile' | 'manage_watcher' | 'monitor' | 'monitor_data_frame_transforms' | 'monitor_data_stream_global_retention' | 'monitor_enrich' | 'monitor_inference' | 'monitor_ml' | 'monitor_rollup' | 'monitor_snapshot' | 'monitor_stats' | 'monitor_text_structure' | 'monitor_transform' | 'monitor_watcher' | 'none' | 'post_behavioral_analytics_event' | 'read_ccr' | 'read_fleet_secrets' | 'read_ilm' | 'read_pipeline' | 'read_security' | 'read_slm' | 'transport_client' | 'write_connector_secrets' | 'write_fleet_secrets'| string +export type SecurityClusterPrivilege = 'all' | 'cancel_task' | 'create_snapshot' | 'cross_cluster_replication' | 'cross_cluster_search' | 'delegate_pki' | 'grant_api_key' | 'manage' | 'manage_api_key' | 'manage_autoscaling' | 'manage_behavioral_analytics' | 'manage_ccr' | 'manage_data_frame_transforms' | 'manage_data_stream_global_retention' | 'manage_enrich' | 'manage_ilm' | 'manage_index_templates' | 'manage_inference' | 'manage_ingest_pipelines' | 'manage_logstash_pipelines' | 'manage_ml' | 'manage_oidc' | 'manage_own_api_key' | 'manage_pipeline' | 'manage_rollup' | 'manage_saml' | 'manage_search_application' | 'manage_search_query_rules' | 'manage_search_synonyms' | 'manage_security' | 'manage_service_account' | 'manage_slm' | 'manage_token' | 'manage_transform' | 'manage_user_profile' | 'manage_watcher' | 'monitor' | 'monitor_data_frame_transforms' | 'monitor_data_stream_global_retention' | 'monitor_enrich' | 'monitor_esql' | 'monitor_inference' | 'monitor_ml' | 'monitor_rollup' | 'monitor_snapshot' | 'monitor_stats' | 'monitor_text_structure' | 'monitor_transform' | 'monitor_watcher' | 'none' | 'post_behavioral_analytics_event' | 'read_ccr' | 'read_fleet_secrets' | 'read_ilm' | 'read_pipeline' | 'read_security' | 'read_slm' | 'transport_client' | 'write_connector_secrets' | 'write_fleet_secrets'| string export interface SecurityCreatedStatus { created: boolean diff --git a/specification/esql/get_query/GetQueryRequest.ts b/specification/esql/get_query/GetQueryRequest.ts index 534cd1fdbd..d41d61328b 100644 --- a/specification/esql/get_query/GetQueryRequest.ts +++ b/specification/esql/get_query/GetQueryRequest.ts @@ -25,16 +25,16 @@ import { Id } from '@_types/common' * Returns an object extended information about a running ES|QL query. * * @rest_spec_name esql.get_query - * @index_previleges monitor_esql + * @cluster_privileges monitor_esql */ export interface Request extends RequestBase { urls: [ { - path: '/_query/queries/{query_task_id}' + path: '/_query/queries/{id}' methods: ['GET'] } ] path_parts: { - query_task_id: Id + id: Id } } diff --git a/specification/esql/list_queries/ListQueriesRequest.ts b/specification/esql/list_queries/ListQueriesRequest.ts index 71460b2b75..a6ee8e96f2 100644 --- a/specification/esql/list_queries/ListQueriesRequest.ts +++ b/specification/esql/list_queries/ListQueriesRequest.ts @@ -24,7 +24,7 @@ import { RequestBase } from '@_types/Base' * Returns an object containing IDs and other information about the running ES|QL queries. * @rest_spec_name esql.list_queries - * @index_previleges monitor_esql + * @cluster_privileges monitor_esql */ export interface Request extends RequestBase { urls: [ diff --git a/specification/esql/list_queries/ListQueriesResponse.ts b/specification/esql/list_queries/ListQueriesResponse.ts index d4659a5010..007d2fea68 100644 --- a/specification/esql/list_queries/ListQueriesResponse.ts +++ b/specification/esql/list_queries/ListQueriesResponse.ts @@ -17,6 +17,7 @@ * under the License. */ +import { Dictionary } from '@spec_utils/Dictionary' import { NodeId, TaskId } from '@_types/common' import { long } from '@_types/Numeric' @@ -30,6 +31,6 @@ export class Body { export class Response { body: { - queries: Record + queries: Dictionary } } diff --git a/specification/security/_types/Privileges.ts b/specification/security/_types/Privileges.ts index 6223ef9cfd..639f5c3e61 100644 --- a/specification/security/_types/Privileges.ts +++ b/specification/security/_types/Privileges.ts @@ -83,6 +83,7 @@ export enum ClusterPrivilege { */ manage_data_stream_global_retention, manage_enrich, + manage_esql, /** * @availability stack */ @@ -141,6 +142,7 @@ export enum ClusterPrivilege { */ monitor_data_stream_global_retention, monitor_enrich, + monitor_esql, monitor_inference, monitor_ml, /** From 1eb5ea3050a3cb200cdd7ab97d396ec178c4cc65 Mon Sep 17 00:00:00 2001 From: Gal Lalouche Date: Tue, 15 Apr 2025 14:04:20 +0300 Subject: [PATCH 7/8] Add availability --- specification/esql/get_query/GetQueryRequest.ts | 2 ++ specification/esql/list_queries/ListQueriesRequest.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/specification/esql/get_query/GetQueryRequest.ts b/specification/esql/get_query/GetQueryRequest.ts index 534cd1fdbd..b5a989c71a 100644 --- a/specification/esql/get_query/GetQueryRequest.ts +++ b/specification/esql/get_query/GetQueryRequest.ts @@ -26,6 +26,8 @@ import { Id } from '@_types/common' * * @rest_spec_name esql.get_query * @index_previleges monitor_esql + * @availability stack since=9.1.0 stability=experiemental visibility=public + * @availability serverless stability=experimental visibility=public */ export interface Request extends RequestBase { urls: [ diff --git a/specification/esql/list_queries/ListQueriesRequest.ts b/specification/esql/list_queries/ListQueriesRequest.ts index 71460b2b75..37069307ef 100644 --- a/specification/esql/list_queries/ListQueriesRequest.ts +++ b/specification/esql/list_queries/ListQueriesRequest.ts @@ -25,6 +25,8 @@ import { RequestBase } from '@_types/Base' * @rest_spec_name esql.list_queries * @index_previleges monitor_esql + * @availability stack since=9.1.0 stability=experiemental visibility=public + * @availability serverless stability=experimental visibility=public */ export interface Request extends RequestBase { urls: [ From eeee283df6627f8d1c5c9367c2aec4ee1352a419 Mon Sep 17 00:00:00 2001 From: Gal Lalouche Date: Tue, 15 Apr 2025 14:08:51 +0300 Subject: [PATCH 8/8] Fix typo --- specification/esql/get_query/GetQueryRequest.ts | 2 +- specification/esql/list_queries/ListQueriesRequest.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/esql/get_query/GetQueryRequest.ts b/specification/esql/get_query/GetQueryRequest.ts index 070690011b..f7836755d6 100644 --- a/specification/esql/get_query/GetQueryRequest.ts +++ b/specification/esql/get_query/GetQueryRequest.ts @@ -26,7 +26,7 @@ import { Id } from '@_types/common' * * @rest_spec_name esql.get_query * @cluster_privileges monitor_esql - * @availability stack since=9.1.0 stability=experiemental visibility=public + * @availability stack since=9.1.0 stability=experimental visibility=public * @availability serverless stability=experimental visibility=public */ export interface Request extends RequestBase { diff --git a/specification/esql/list_queries/ListQueriesRequest.ts b/specification/esql/list_queries/ListQueriesRequest.ts index 87b2f43305..e52f1bf880 100644 --- a/specification/esql/list_queries/ListQueriesRequest.ts +++ b/specification/esql/list_queries/ListQueriesRequest.ts @@ -25,7 +25,7 @@ import { RequestBase } from '@_types/Base' * @rest_spec_name esql.list_queries * @cluster_privileges monitor_esql - * @availability stack since=9.1.0 stability=experiemental visibility=public + * @availability stack since=9.1.0 stability=experimental visibility=public * @availability serverless stability=experimental visibility=public */ export interface Request extends RequestBase {