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 85de02e254..5de747d0b1 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": [ { @@ -126187,6 +126209,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": [ @@ -205114,7 +205388,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L434-L436" + "specLocation": "security/_types/Privileges.ts#L436-L438" }, { "kind": "interface", @@ -205310,6 +205584,9 @@ { "name": "manage_enrich" }, + { + "name": "manage_esql" + }, { "availability": { "stack": {} @@ -205418,6 +205695,9 @@ { "name": "monitor_enrich" }, + { + "name": "monitor_esql" + }, { "name": "monitor_inference" }, @@ -205518,7 +205798,7 @@ "name": "ClusterPrivilege", "namespace": "security._types" }, - "specLocation": "security/_types/Privileges.ts#L42-L199" + "specLocation": "security/_types/Privileges.ts#L42-L201" }, { "kind": "interface", @@ -205592,7 +205872,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L430-L432" + "specLocation": "security/_types/Privileges.ts#L432-L434" }, { "kind": "enum", @@ -205705,7 +205985,7 @@ "name": "IndexPrivilege", "namespace": "security._types" }, - "specLocation": "security/_types/Privileges.ts#L386-L428" + "specLocation": "security/_types/Privileges.ts#L388-L430" }, { "kind": "interface", @@ -205799,7 +206079,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L216-L242" + "specLocation": "security/_types/Privileges.ts#L218-L244" }, { "kind": "type_alias", @@ -205813,7 +206093,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": [ @@ -205863,7 +206143,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L438-L440" + "specLocation": "security/_types/Privileges.ts#L440-L442" }, { "kind": "interface", @@ -205921,7 +206201,7 @@ "name": "RemoteClusterPrivilege", "namespace": "security._types" }, - "specLocation": "security/_types/Privileges.ts#L201-L213" + "specLocation": "security/_types/Privileges.ts#L203-L215" }, { "kind": "interface", @@ -205959,7 +206239,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L278-L290" + "specLocation": "security/_types/Privileges.ts#L280-L292" }, { "kind": "interface", @@ -206066,7 +206346,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L244-L276" + "specLocation": "security/_types/Privileges.ts#L246-L278" }, { "kind": "interface", @@ -206176,7 +206456,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L316-L339" + "specLocation": "security/_types/Privileges.ts#L318-L341" }, { "kind": "interface", @@ -206226,7 +206506,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L442-L452" + "specLocation": "security/_types/Privileges.ts#L444-L454" }, { "kind": "interface", @@ -206889,7 +207169,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": [ @@ -206932,7 +207212,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L351-L361" + "specLocation": "security/_types/Privileges.ts#L353-L363" }, { "kind": "interface", @@ -207020,7 +207300,7 @@ } ], "shortcutProperty": "source", - "specLocation": "security/_types/Privileges.ts#L363-L381" + "specLocation": "security/_types/Privileges.ts#L365-L383" }, { "kind": "interface", @@ -207099,7 +207379,7 @@ } } ], - "specLocation": "security/_types/Privileges.ts#L454-L474" + "specLocation": "security/_types/Privileges.ts#L456-L476" }, { "kind": "interface", @@ -207346,7 +207626,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 dc23e27034..59378e0113 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 new file mode 100644 index 0000000000..f7836755d6 --- /dev/null +++ b/specification/esql/get_query/GetQueryRequest.ts @@ -0,0 +1,42 @@ +/* + * 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 + * @cluster_privileges monitor_esql + * @availability stack since=9.1.0 stability=experimental visibility=public + * @availability serverless stability=experimental visibility=public + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_query/queries/{id}' + methods: ['GET'] + } + ] + path_parts: { + id: Id + } +} diff --git a/specification/esql/get_query/GetQueryResponse.ts b/specification/esql/get_query/GetQueryResponse.ts new file mode 100644 index 0000000000..93e3104825 --- /dev/null +++ b/specification/esql/get_query/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 } from '@_types/common' +import { long } from '@_types/Numeric' + +export class Response { + 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/list_queries/ListQueriesRequest.ts b/specification/esql/list_queries/ListQueriesRequest.ts new file mode 100644 index 0000000000..e52f1bf880 --- /dev/null +++ b/specification/esql/list_queries/ListQueriesRequest.ts @@ -0,0 +1,38 @@ +/* + * 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 + * @cluster_privileges monitor_esql + * @availability stack since=9.1.0 stability=experimental visibility=public + * @availability serverless stability=experimental visibility=public + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_query/queries' + methods: ['GET'] + } + ] +} diff --git a/specification/esql/list_queries/ListQueriesResponse.ts b/specification/esql/list_queries/ListQueriesResponse.ts new file mode 100644 index 0000000000..007d2fea68 --- /dev/null +++ b/specification/esql/list_queries/ListQueriesResponse.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 { Dictionary } from '@spec_utils/Dictionary' +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: 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, /**