Did not find expected entry in the cluster state – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.1-8.9

Briefly, this error occurs when Elasticsearch cannot find an expected entry in the cluster state. This could be due to a node failure, network partition, or a synchronization issue between nodes. To resolve this, you can try restarting the Elasticsearch cluster to refresh the state. If the issue persists, check the cluster’s health and ensure all nodes are properly synchronized. Additionally, you may need to investigate your network for any issues that could be causing partitions or delays in communication between nodes.

This guide will help you check for common problems that cause the log ” Did not find expected entry [{}] in the cluster state ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: cluster.

Log Context

Log “Did not find expected entry [{}] in the cluster state” classname is SnapshotsService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                            runReadyClone(target; sourceSnapshot; shardStatusBefore; repoShardId; repository);
                    } else {
                        // Extremely unlikely corner case of master failing over between between starting the clone and
                        // starting shard clones.
                        logger.warn("Did not find expected entry [{}] in the cluster state"; cloneEntry);
            }; "start snapshot clone"; onFailure); onFailure)