ES|QL 任务管理
编辑ES|QL 任务管理
编辑您可以使用任务管理 API 列出正在运行的 ES|QL 查询。
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
它会返回如下状态列表:
{ "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" : { } }
您可以使用此功能查找长时间运行的查询,如果需要,可以使用任务取消 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
停止查询可能需要几秒钟。