Cannot manage cluster alerts because watches index is not allocated – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.11-8.9

Briefly, this error occurs when Elasticsearch cannot manage cluster alerts due to the unallocated [.watches] index. This index is used for storing watch data and its unavailability can disrupt alert management. To resolve this, you can try to manually allocate the index using the reroute API. Alternatively, ensure that there are enough nodes and disk space in the cluster for allocation. Also, check for any hardware failures or network partitions that might prevent allocation. Lastly, adjusting the index settings or cluster settings might help in index allocation.

This guide will help you check for common problems that cause the log ” cannot manage cluster alerts because [.watches] index is not allocated ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, cluster.

Log Context

Log “cannot manage cluster alerts because [.watches] index is not allocated” class name is LocalExporter.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
final IndexRoutingTable watches = clusterState.routingTable().index(Watch.INDEX);
final boolean indexExists = watches != null && watches.allPrimaryShardsActive(); // we cannot do anything with watches until the index is allocated; so we wait until it's ready
if (watches != null && watches.allPrimaryShardsActive() == false) {
errors.add(new ElasticsearchException("cannot manage cluster alerts because [.watches] index is not allocated"));
logger.trace("cannot manage cluster alerts because [.watches] index is not allocated");
} else if ((watches == null || indexExists) && watcherSetup.compareAndSet(false; true)) {
addClusterAlertsRemovalAsyncActions(indexExists; asyncActions; pendingResponses; setupListener; errors);
}
} else {<p></p>
final IndexRoutingTable watches = clusterState.routingTable().index(Watch.INDEX); final boolean indexExists = watches != null && watches.allPrimaryShardsActive(); // we cannot do anything with watches until the index is allocated; so we wait until it's ready if (watches != null && watches.allPrimaryShardsActive() == false) { errors.add(new ElasticsearchException("cannot manage cluster alerts because [.watches] index is not allocated")); logger.trace("cannot manage cluster alerts because [.watches] index is not allocated"); } else if ((watches == null || indexExists) && watcherSetup.compareAndSet(false; true)) { addClusterAlertsRemovalAsyncActions(indexExists; asyncActions; pendingResponses; setupListener; errors); } } else {<p></p>
 final IndexRoutingTable watches = clusterState.routingTable().index(Watch.INDEX);
 final boolean indexExists = watches != null && watches.allPrimaryShardsActive();  // we cannot do anything with watches until the index is allocated; so we wait until it's ready
 if (watches != null && watches.allPrimaryShardsActive() == false) {
 errors.add(new ElasticsearchException("cannot manage cluster alerts because [.watches] index is not allocated"));
 logger.trace("cannot manage cluster alerts because [.watches] index is not allocated");
 } else if ((watches == null || indexExists) && watcherSetup.compareAndSet(false; true)) {
 addClusterAlertsRemovalAsyncActions(indexExists; asyncActions; pendingResponses; setupListener; errors);
 }
 } else {

 

 [ratemypost]