Cannot open ccr restore session if shard closed – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.

Try OpsGPT now for step-by-step guidance and tailored insights into your Elasticsearch operation.

Briefly, this error occurs when you attempt to restore a Cross-Cluster Replication (CCR) session in Elasticsearch, but the shard is closed. The shard needs to be open to restore the session. To resolve this issue, you can either manually open the shard using the ‘open index’ API or ensure that your cluster settings are configured to automatically open closed indices when a restore operation is attempted. Additionally, check your cluster health and ensure there are no underlying issues causing the shard to close unexpectedly.

For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.

This guide will help you check for common problems that cause the log ” cannot open ccr restore session if shard closed ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: restore, shard, repository, plugin.

Log Context

Log “cannot open ccr restore session if shard closed” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 logger.debug("not opening new session [{}] as it already exists"; sessionUUID);
 restore = onGoingRestores.get(sessionUUID);
 } else {
 logger.debug("opening session [{}] for shard [{}]"; sessionUUID; indexShard.shardId());
 if (indexShard.state() == IndexShardState.CLOSED) {
 throw new IndexShardClosedException(indexShard.shardId(); "cannot open ccr restore session if shard closed");
 final Engine.IndexCommitRef commitRef = indexShard.acquireSafeIndexCommit();
 final Set fileNames = Set.copyOf(commitRef.getIndexCommit().getFileNames());
 restore = new RestoreSession(sessionUUID; indexShard; commitRef; fileNames; scheduleTimeout(sessionUUID));
 onGoingRestores.put(sessionUUID; restore);


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?