How do you delete a completed task for a Delete-By-Query in Elasticsearch 5.6?

I currently have a completed delete-by-query task:

curl -XGET "http://localhost/_tasks/x0i0D1FdEs-M29DDewnPwkg:257894116" {"completed":true,"task":{"node":"x0i0D1FdEs-M29DDewnPwkg","id":257894116,"type":"transport","action":"indices:data/write/delete/byquery","status":{"total":2650620,"updated":0,"created":0,"deleted":2650620,"batches":2651,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0},"description":"delete-by-query [testIndex]","start_time_in_millis":1509555456799,"running_time_in_nanos":386994755521,"cancellable":true},"response":{"took":386993,"timed_out":false,"total":2650620,"updated":0,"created":0,"deleted":2650620,"batches":2651,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}}%

The delete-by-query documentation for Tasks says the following:

If the request contains wait_for_completion=false then Elasticsearch will perform some preflight checks, launch the request, and then return a task which can be used with Tasks APIs to cancel or get the status of the task. Elasticsearch will also create a record of this task as a document at .tasks/task/${taskId}. This is yours to keep or remove as you see fit. When you are done with it, delete it so Elasticsearch can reclaim the space it uses.

Yet when I run the following:

curl -XDELETE "http:localhost/_tasks/x0i0D1FdEs-M29DDewnPwkg:257894116"

I get

No handler found for uri [/_tasks/x0i0D1FdEs-M29DDewnPwkg:257894116] and method [DELETE]%

The Elasticsearch documentation confuses me and I don't know if I need to delete these delete-by-query tasks.

1 answer

  • answered 2017-11-15 04:33 Val

    You need to delete the task with the following command

    curl -XDELETE "http:localhost/.tasks/task/x0i0D1FdEs-M29DDewnPwkg:257894116"