Elasticsearch indices.recovery.use_snapshots Setting

Pulse - Elasticsearch Operations Done Right

On this page

Brief Explanation Description Example Common Issues or Misuses Do's and Don'ts Frequently Asked Questions

Brief Explanation

The indices.recovery.use_snapshots setting in Elasticsearch controls whether the cluster should use snapshot files for recovery operations when possible. This setting can significantly impact the speed and efficiency of index recovery processes, especially in scenarios involving large indices or frequent snapshot-based recoveries.

Description

  • Default Value: true
  • Possible Values: true or false
  • Recommendations: It is generally recommended to keep this setting enabled (true) for most use cases, as it can lead to faster recovery times and reduced network traffic.

When set to true, Elasticsearch will attempt to use snapshot files for recovery operations if they are available and up-to-date. This can be particularly beneficial in scenarios where indices are large or when network bandwidth between nodes is limited.

Example

To change the indices.recovery.use_snapshots setting using the cluster settings API:

PUT _cluster/settings
{
  "persistent": {
    "indices.recovery.use_snapshots": false
  }
}

Changing this setting to false might be considered if you're experiencing issues with snapshot-based recoveries or if you want to force Elasticsearch to always use peer recovery. However, this is generally not recommended unless specifically advised by Elasticsearch support or for troubleshooting purposes.

Common Issues or Misuses

  1. Disabling this setting without a valid reason, leading to potentially slower recoveries and increased network usage.
  2. Assuming that enabling this setting will always result in faster recoveries, without considering factors like snapshot age or changes in index data.

Do's and Don'ts

Do's:

  • Keep this setting enabled (true) in most scenarios.
  • Ensure your snapshot repository is properly configured and accessible.
  • Monitor recovery times and adjust your snapshot frequency if needed.

Don'ts:

  • Don't disable this setting without a specific reason or guidance from Elasticsearch support.
  • Don't assume that snapshot-based recovery will always be faster; consider the age and completeness of your snapshots.

Frequently Asked Questions

Q: How does the indices.recovery.use_snapshots setting affect recovery time?
A: When enabled, this setting allows Elasticsearch to use snapshot files for recovery, which can significantly reduce recovery time, especially for large indices or in scenarios with limited network bandwidth between nodes.

Q: Can enabling this setting negatively impact my cluster's performance?
A: Generally, no. This setting is designed to optimize recovery processes. However, if your snapshots are outdated or incomplete, it might lead to longer recovery times compared to peer recovery in some cases.

Q: Is it safe to change this setting on a production cluster?
A: Yes, it's safe to change this setting on a production cluster. However, it's recommended to keep it enabled unless you have a specific reason to disable it.

Q: How does Elasticsearch decide whether to use snapshots or peer recovery?
A: When this setting is enabled, Elasticsearch will first check if a suitable snapshot is available for recovery. If a recent and complete snapshot exists, it will be used. Otherwise, Elasticsearch will fall back to peer recovery.

Q: Does this setting affect all types of recovery operations in Elasticsearch?
A: This setting primarily affects shard recovery operations, such as when restarting nodes or rebalancing shards. It does not affect other types of operations like index creation or real-time indexing.

Subscribe to the Pulse Newsletter

Get early access to new Pulse features, insightful blogs & exclusive events , webinars, and workshops.