Snapshot has no segments file – How to solve this Elasticsearch error

Average Read Time

2 Mins

Snapshot has no segments file – How to solve this Elasticsearch error

Opster Team

March-22, Version: 1.7-8.0

Before you begin reading this guide, we recommend you try running the Elasticsearch Check-Up which can resolve issues that cause many errors.

This guide will help you check for common problems that cause the log ” Snapshot has no segments file ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: repositories, snapshot, blobstore.

Advanced users might want to skip right to the common problems section in each concept or try running the Check-Up to analyze Elasticsearch configuration and help resolve this error.

Log Context

Log “Snapshot has no segments file”classname  is FileRestoreContext.java We extracted the following from Elasticsearch source code for those seeking an in-depth context :

final Store.MetadataSnapshot sourceMetadata = new Store.MetadataSnapshot(unmodifiableMap(snapshotMetadata); emptyMap(); 0); 
 final StoreFileMetadata restoredSegmentsFile = sourceMetadata.getSegmentsFile();
 if (restoredSegmentsFile == null) {
 throw new IndexShardRestoreFailedException(shardId; "Snapshot has no segments file");
 } 
 final Store.RecoveryDiff diff = sourceMetadata.recoveryDiff(recoveryTargetMetadata);
 for (StoreFileMetadata md : diff.identical) {
 BlobStoreIndexShardSnapshot.FileInfo fileInfo = fileInfos.get(md.name());

 

Watch a demo of the Check-Up:

Analyze your cluster