Link Search Menu Expand Document Documentation Menu

Delete ML Task API

Deletes a machine learning (ML) task based on the task_id.

ML Commons does not check the task status when running the delete request. There is a risk that a currently running task could be deleted before the task completes. To check the status of a task, run GET /_plugins/_ml/tasks/<task_id> before task deletion.

Endpoints

DELETE /_plugins/_ml/tasks/{task_id}

Example request

DELETE /_plugins/_ml/tasks/xQRYLX8BydmmU1x6nuD3

Example response

{
  "_index" : ".plugins-ml-task",
  "_id" : "xQRYLX8BydmmU1x6nuD3",
  "_version" : 4,
  "result" : "deleted",
  "_shards" : {
    "total" : 2,
    "successful" : 2,
    "failed" : 0
  },
  "_seq_no" : 42,
  "_primary_term" : 7
}

Error responses

If you attempt to delete a task that doesn’t exist, OpenSearch returns a 404 Not Found error:

{
  "error": {
    "root_cause": [
      {
        "type": "status_exception",
        "reason": "Failed to find task"
      }
    ],
    "type": "status_exception",
    "reason": "Failed to find task"
  },
  "status": 404
}
350 characters left

Have a question? .

Want to contribute? or .