Link Search Menu Expand Document Documentation Menu

Delete a model

Deletes a model based on the model_id.

When you delete the last model version in a model group, that model group is automatically deleted from the index.

For information about user access for this API, see Model access control considerations.

Endpoints

DELETE /_plugins/_ml/models/<model_id>

Example request

DELETE /_plugins/_ml/models/MzcIJX8BA7mbufL6DOwl

Example response

{
  "_index" : ".plugins-ml-model",
  "_id" : "MzcIJX8BA7mbufL6DOwl",
  "_version" : 2,
  "result" : "deleted",
  "_shards" : {
    "total" : 2,
    "successful" : 2,
    "failed" : 0
  },
  "_seq_no" : 27,
  "_primary_term" : 18
}

Safely deleting a model

Introduced 2.19

To prevent accidental deletion of models in active use by agents, search pipelines, ingest pipelines, or other components, you can enable a safety check. If the safety check is enabled and you attempt to delete a model that is in current use, OpenSearch returns an error message. To proceed with deletion:

  • Identify any components using the model and either delete them or update them so that they use other models.
  • Once all dependencies are cleared, delete the model.

For information about enabling this feature, see Safely delete models.

350 characters left

Have a question? .

Want to contribute? or .