Cannot delete model as it is currently deployed – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 8-8

Briefly, this error occurs when you attempt to delete a machine learning model in Elasticsearch that is currently in use or deployed. The system prevents deletion to avoid disrupting ongoing processes. To resolve this issue, you can either wait until the model is no longer in use or manually undeploy the model. After ensuring the model is not in use, you can proceed with the deletion. Always ensure to check the deployment status of a model before attempting to delete it.

This guide will help you check for common problems that cause the log ” Cannot delete model [{}] as it is currently deployed ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: delete, plugin.

Log Context

Log “Cannot delete model [{}] as it is currently deployed” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (TrainedModelAllocationMetadata.fromState(state).isAllocated(request.getId())) {
 new ElasticsearchStatusException("Cannot delete model [{}] as it is currently deployed"; RestStatus.CONFLICT; id)
 }  ActionListener nameDeletionListener = ActionListener.wrap(


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?