How to cancel search using the Task Management API


(Jean-Francois Weber-Marx) #1

I would like to cancel a long running search tasks using the Task Management API, but when I try to cancel such a task, I obtain the following error message:
{
"node_failures" : [ {
"type" : "failed_node_exception",
"reason" : "Failed node [EEXZOO90RNGXkReo_sXfig]",
"caused_by" : {
"type" : "resource_not_found_exception",
"reason" : "task [EEXZOO90RNGXkReo_sXfig:255615824] doesn't support cancellation"
}
} ],
"nodes" : { }
}
Is there currently a way to cancel such a task?

Any help would be much appreciated.
Thanks
jfwm


(Zachary Tong) #2

Search does not currently support cancellation. I believe the only tasks supporting cancellation at the moment are Reindex and Delete-By-Query. We'd like to have cancellable search in the future, but because the task management framework is still very new, it may be a while before that functionality is integrated everywhere.

Edit: See below, search cancellation is possible! :slight_smile:


(Jean-Francois Weber-Marx) #3

Thanks for your answer, we are very interested to have this feature. Therefore I believe we are going to dive into the code to see how we could implemented this functionality. Any pointers?


(Jean-Francois Weber-Marx) #4

It seems that the Search cancellation feature is available in 5.x (starting in 5.1): https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search.html#global-search-cancellation


(Zachary Tong) #5

Oops, you're absolutely right! Sorry about that, it's sometimes hard to keep up with all the changes in ES, even when you work on the software :slight_smile:

I'll strike through my answer above so future readers don't get confused


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.