Before you begin reading this guide, we recommend you run Elasticsearch Error Check-Up which can resolve issues that cause many errors.
This guide will help you check for common problems that cause the log ” Failed to sync restore state after master switch ” to appear. It’s important to understand the issues related to the log, so to get started, read the general overview on common issues and tips related to the Elasticsearch concepts: master and restore.
Advanced users might want to skip right to the common problems section in each concept or try running the Check-Up which analyses ES to pinpoint the cause of many errors and provides suitable actionable recommendations how to resolve them (free tool that requires no installation).
Overview
In Elasticsearch, restore refers to the snapshot restore mechanism, which returns indices or clusters to a previous, saved state. You can restore the entire cluster from the snapshot or restore an individual index or selected indices.
Examples
To restore the whole snapshot
POST /_snapshot/my_backup/snapshot-01-11-2019/_restore
To restore an individual index
POST /_snapshot/my_backup/snapshot-01-11-2019/_restore { "indices": "my_index" }
Notes
- If you are using a security tool like Searchguard, the snapshot restore capability must be enabled in elasticsearch.yml. Otherwise, it will throw a security exception.
Common issues
- If an index or indices already exist with the same names as those you are going to restore, they need to either be closed or deleted before you can restore from a snapshot. Otherwise, the restore operation will fail due to an error that the index already exists.
Log Context
Log “failed to sync restore state after master switch” classname is RestoreService.java
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
return resyncRestoreInProgressWithRoutingTable(currentState); } Override public void onFailure(String source; Exception e) { logger.warn("failed to sync restore state after master switch"; e); } }); } } }
Run the Check-Up to get customized recommendations like this:

Heavy merges detected in specific nodes

Description
A large number of small shards can slow down searches and cause cluster instability. Some indices have shards that are too small…

Recommendations Based on your specific ES deployment you should…
Based on your specific ES deployment you should…
X-PUT curl -H [a customized code snippet to resolve the issue]