Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›ES|QL ›Using ES|QL

ES|QL task management

You can list running ES|QL queries with the task management API:

resp = client.tasks.list(
    pretty=True,
    detailed=True,
    group_by="parents",
    human=True,
    actions="*data/read/esql",
)
print(resp)
response = client.tasks.list(
  pretty: true,
  detailed: true,
  group_by: 'parents',
  human: true,
  actions: '*data/read/esql'
)
puts response
const response = await client.tasks.list({
  pretty: "true",
  detailed: "true",
  group_by: "parents",
  human: "true",
  actions: "*data/read/esql",
});
console.log(response);
GET /_tasks?pretty&detailed&group_by=parents&human&actions=*data/read/esql

Which returns a list of statuses like this:

{
  "node" : "2j8UKw1bRO283PMwDugNNg",
  "id" : 5326,
  "type" : "transport",
  "action" : "indices:data/read/esql",
  "description" : "FROM test | STATS MAX(d) by a, b",  
  "start_time" : "2023-07-31T15:46:32.328Z",
  "start_time_in_millis" : 1690818392328,
  "running_time" : "41.7ms",                           
  "running_time_in_nanos" : 41770830,
  "cancellable" : true,
  "cancelled" : false,
  "headers" : { }
}

The user submitted query.

Time the query has been running.

You can use this to find long running queries and, if you need to, cancel them with the task cancellation API:

resp = client.tasks.cancel(
    task_id="2j8UKw1bRO283PMwDugNNg:5326",
)
print(resp)
response = client.tasks.cancel(
  task_id: '2j8UKw1bRO283PMwDugNNg:5326'
)
puts response
const response = await client.tasks.cancel({
  task_id: "2j8UKw1bRO283PMwDugNNg:5326",
});
console.log(response);
POST _tasks/2j8UKw1bRO283PMwDugNNg:5326/_cancel

It may take a few seconds for the query to be stopped.

© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/esql-task-management.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API