Skip to content

Commit bd2bc40

Browse files
committed
ESQL: Add query monitoring API
1 parent 1447a82 commit bd2bc40

File tree

4 files changed

+142
-0
lines changed

4 files changed

+142
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { RequestBase } from '@_types/Base'
21+
import { Id } from '@_types/common'
22+
23+
/**
24+
* Get a specific running ES|QL query information.
25+
* Returns an object extended information about a running ES|QL query.
26+
*
27+
* @rest_spec_name esql.get_query
28+
* @index_previleges monitor_esql
29+
*/
30+
export interface GetQueryRequest extends RequestBase {
31+
urls: [
32+
{
33+
path: '/_query/queries/{query_task_id}'
34+
methods: ['GET']
35+
}
36+
]
37+
path_parts: {
38+
query_task_id: Id
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { NodeId, TaskId } from '@_types/common'
21+
import { long } from '@_types/Numeric'
22+
23+
export class GetQueryResponse {
24+
body: {
25+
id: long
26+
node: NodeId
27+
start_time_millis: long
28+
running_time_nanos: long
29+
query: string
30+
coordinating_node: NodeId
31+
data_nodes: NodeId[]
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { RequestBase } from '@_types/Base'
21+
22+
/**
23+
* Get running ES|QL queries information.
24+
* Returns an object containing IDs and other information about the running ES|QL queries.
25+
26+
* @rest_spec_name esql.list_queries
27+
* @index_previleges monitor_esql
28+
*/
29+
export interface ListQueryRequest extends RequestBase {
30+
urls: [
31+
{
32+
path: '/_query/queries'
33+
methods: ['GET']
34+
}
35+
]
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { NodeId, TaskId } from '@_types/common'
21+
import { long } from '@_types/Numeric'
22+
23+
export class ListQueryResponse {
24+
body: {
25+
queries: Record<TaskId, {
26+
id: long
27+
node: NodeId
28+
start_time_millis: long
29+
running_time_nanos: long
30+
query: string
31+
}>
32+
}
33+
}

0 commit comments

Comments
 (0)