Reputation: 7391
I'm using ElasticSearch 7.1.1 and use delete_by_query API to remove required documents asynchronously. As result that query return to me task id. When I execute next query:
GET {elasticsearch_cluster_url}/_tasks/{taskId}
I'm able to get correspond document for the task. But when I try to execute such query:
GET {elasticsearch_cluster_url}/_tasks?detailed=true&actions=*/delete/byquery
I don't see my task in the result list.
I also tried to execute such query:
GET {elasticsearch_cluster_url}/_tasks
And I got such response:
{
"nodes": {
"hWZQF7w_Rs6_ZRDZkGpSwQ": {
"name": "0d5027c3ae6f0bb0105dcdb04470af43",
"roles": [
"master"
,
"data"
,
"ingest"
],
"tasks": {
"hWZQF7w_Rs6_ZRDZkGpSwQ:194259297": {
"node": "hWZQF7w_Rs6_ZRDZkGpSwQ",
"id": 194259297,
"type": "transport",
"action": "cluster:monitor/tasks/lists",
"start_time_in_millis": 1596710876682,
"running_time_in_nanos": 214507,
"cancellable": false,
"headers": { }
},
"hWZQF7w_Rs6_ZRDZkGpSwQ:194259298": {
"node": "hWZQF7w_Rs6_ZRDZkGpSwQ",
"id": 194259298,
"type": "direct",
"action": "cluster:monitor/tasks/lists[n]",
"start_time_in_millis": 1596710876682,
"running_time_in_nanos": 84696,
"cancellable": false,
"parent_task_id": "hWZQF7w_Rs6_ZRDZkGlDwQ:194259297",
"headers": { }
}
}
}
}
}
I'm not sure, maybe that query returns the tasks only from one cluster's node that accepted the query? Why my task is missed in the last query? Is there some mistake in my query parameters?
Upvotes: 0
Views: 710
Reputation: 217584
If your delete by query call is very short-lived, you're not going to see it in _tasks
after the query has run.
If you want to keep a trace of your calls, you need to add ?wait_for_completion=false
to your call.
While the query is running, you're going to see it using GET _tasks
, however, when the query has finished running, you won't see it anymore using GET _tasks
, but GET .tasks/_search
instead.
After it's done running and you have specified wait_for_completion=false
, you can see the details of your finished task with GET .tasks/task/<task-id>
Upvotes: 2