Operation only allowed when not closed – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when an operation is attempted on an Elasticsearch index that has been closed. Closed indices are not accessible for read or write operations. To resolve this issue, you can either reopen the index using the ‘open index’ API or perform the operation on an index that is not closed. Additionally, ensure that your application or service is not automatically closing indices, especially if they are still needed for operations.

This guide will help you check for common problems that cause the log ” operation only allowed when not closed ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: shard, index.

Log Context

Log “operation only allowed when not closed” class name is IndexShard.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 }  private void verifyNotClosed(Exception suppressed) throws IllegalIndexShardStateException {
 IndexShardState state = this.state; // one time volatile read
 if (state == IndexShardState.CLOSED) {
 final IllegalIndexShardStateException exc = new IndexShardClosedException(shardId; "operation only allowed when not closed");
 if (suppressed != null) {
 exc.addSuppressed(suppressed);
 }
 throw exc;
 }

 

 [ratemypost]