Allocation for model with id not found – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 8-8.2

Briefly, this error occurs when Elasticsearch cannot find the allocation for a specific model ID. This could be due to the model ID being deleted, not yet created, or incorrectly referenced. To resolve this issue, you can verify if the model ID exists in your Elasticsearch cluster. If it doesn’t, you need to create it. If it does exist, ensure that it is correctly referenced in your query. Also, check if there are any issues with your cluster’s health that might be preventing the allocation.

This guide will help you check for common problems that cause the log ” allocation for model with id [{}] not found ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: allocation, plugin.

Log Context

Log “allocation for model with id [{}] not found” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 static ClusterState setToStopping(ClusterState clusterState; String modelId; String reason) {
 TrainedModelAllocationMetadata metadata = TrainedModelAllocationMetadata.fromState(clusterState);
 final TrainedModelAllocation existingAllocation = metadata.getModelAllocation(modelId);
 if (existingAllocation == null) {
 throw new ResourceNotFoundException("allocation for model with id [{}] not found"; modelId);
 // If we are stopping; don't update anything
 if (existingAllocation.getAllocationState().equals(AllocationState.STOPPING)) {
 return clusterState;