Closed
Description
Spotted in 7.3.0
When trying to stop a failed data frame transform without specifying force=true
in query params, the status code and format of the response is not what you'd expect.
Currently the API responds with 200 and the body looks like this:
{
"task_failures" : [ {
"task_id" : 15302,
"node_id" : "1TYVPNuERNe40f9tTRPVAQ",
"status" : "CONFLICT",
"reason" : {
"type" : "status_exception",
"reason" : "Unable to stop data frame transform [some_data_frame_id] as it is in a failed state with reason: [task encountered more than 10 failures; latest failure: Failed to retrieve checkpoint]. Use force stop to stop the data frame transform."
}
} ],
"acknowledged" : false
}
In order to be consistent with the rest of the ML APIs, what we should be receiving instead should be a 409 and a body that looks like this:
{
"error": {
"root_cause": [
{
"type": "status_exception",
"reason": "Unable to stop data frame transform [some_data_frame_id] as it is in a failed state. Use force stop to stop the data frame transform."
}
],
"type": "status_exception",
"reason": "Unable to stop data frame transform [some_data_frame_id] as it is in a failed state. Use force stop to stop the data frame transform."
},
"status": 409
}
Steps to reproduce
- Create a data frame
- Start it and cause it to fail. (deleting the source index is one way to do it)
- After the task state becomes
failed
, send the_stop
request without specifyingforce=true
as a query parameter. - Notice that the response status code and body format is not consistent with the usual error response format in ES APIs.