Jinggang
Jinggang

Reputation: 431

How to delete a task document in elasticsearch?

If I understand it correctly, all tasks will be store in a index called .task. In ES 6.2, after the task is finished, I am able to do DELETE http://localhost:9200/.tasks/task/ZKUuxQZpRCCcJ0njBM1P0A:9637 to remove task document ZKUuxQZpRCCcJ0njBM1P0A:9637 from .task index.

However, when running ES 5.5, calling the same API always gives me "result": "not_found".

I also tried to check .task index/file directly by calling GET http://localhost:9200/.tasks/task/ZKUuxQZpRCCcJ0njBM1P0A:9637, this gives me index_not_found_exception.

How to delete a task document in ES 5.5? Or how to access a system index in ES any-version?

Thank you.

Upvotes: 3

Views: 3208

Answers (1)

Jinggang
Jinggang

Reputation: 431

So, I am actually able to delete a task both in ES 5.5 and ES 6.2 using

DELETE http://localhost:9200/.tasks/task/ZKUuxQZpRCCcJ0njBM1P0A:9637

The reason I failed to delete some tasks, is that those tasks came from other server's requests with wait_for_complete == true. From my understanding, a wait_for_complete == true task is an "in-memory" only task. If such a task is canceled/completed, it is gone.

The tasks that will be stored in .task system index, are the tasks with wait_for_complete == false.

Upvotes: 4

Related Questions