Work with snapshots

Snapshots provide a way to restore your Elasticsearch indices. They can be used to copy indices for testing, to recover from failures or accidental deletions, or to migrate data to other deployments.

By default, Elasticsearch Add-On for Heroku takes a snapshot of all the indices in your Elasticsearch cluster every 30 minutes. You can set a different snapshot interval, if needed for your environment. You can also take snapshots on demand, without having to wait for the next interval. Taking a snapshot on demand does not affect the retention schedule for existing snapshots, it just adds an additional snapshot to the repository. This might be helpful if you are about to make a deployment change and you don’t have a current snapshot.

Snapshots back up only open indices. If you close an index, it is not included in snapshots and you will not be able to restore the data.

Beginning with Elastic Stack version 7.6, use Kibana to manage your snapshots. In Kibana, you can set up additional repositories where the snapshots are stored, other than the one currently managed by {s}. You can view and delete snapshots, and configure a snapshot lifecycle management (SLM) policy to automate when snapshots are created and deleted. To learn more, see the Kibana Snapshot and Restore documentation.

From within Elasticsearch Add-On for Heroku you can view the list of snapshots and also restore a snapshot from a different deployment in the same region.

For deployments with Elastic Stack versions 7.5 and earlier, anywhere between a minimum of 12 and up to a maximum of the 100 most recent, successful snapshots may be stored. These tasks are available from the Elasticsearch Add-On for Heroku UI:

List available snapshots

To list all available snapshots:

  1. Log in to the Elasticsearch Add-On for Heroku console.
  2. On the deployments page, select your deployment.

    Narrow your deployments by name, ID, or choose from several other filters. To customize your view, use a combination of filters, or change the format from a grid to a list.

  3. From your deployment menu, go to Elasticsearch and then Snapshots where the list of available snapshots is shown, newest first.
  4. Click on a specific snapshot to see more details.

The list shows when the snapshot was completed, whether the snapshot succeeded or was only partially successful, along with the number of shards and indices in the snapshot.

Configure the snapshot retention period

For Elastic Stack versions 7.6 and above, refer to the Kibana Snapshot and Restore documentation to learn about the snapshot management features.

For Elastic Stack versions 7.5 and below, from within Elasticsearch Add-On for Heroku you can set the snapshot interval and count to have control over the retention period for your clusters. The calculation displayed is based on a projected estimate of the snapshot interval, expected snapshot count, and current cluster size. Changing any of these factors results in a different retention period.

Change the snapshot interval

If you find the the default snapshot interval isn’t working for your environment, you can change it. It might make sense to use a 4 or 24 hour interval if the data in your index doesn’t change that often but you need more snapshot history.

  1. Log in to the Elasticsearch Add-On for Heroku console.
  2. On the deployments page, select your deployment.

    Narrow your deployments by name, ID, or choose from several other filters. To customize your view, use a combination of filters, or change the format from a grid to a list.

  3. Open the Snapshot settings section.
  4. Make a selection from the Snapshot interval drop-down menu.
  5. Click Update settings.

When you change the interval, the interval timer begins after the next scheduled snapshot.

Change the snapshot count

You can get more control over your repository space by adjusting the number of snapshots that are stored for your cluster. The minimum number of snapshots must be at least 12, the maximum limit is 100.

  1. Log in to the Elasticsearch Add-On for Heroku console.
  2. On the deployments page, select your deployment.

    Narrow your deployments by name, ID, or choose from several other filters. To customize your view, use a combination of filters, or change the format from a grid to a list.

  3. Open the Snapshot settings section.
  4. Enter a number in the Snapshot count field.
  5. Click Update settings.

Restore a snapshot

For Elastic Stack versions 7.6 and above, for details about restoring a snapshot see the Kibana Snapshot and Restore documentation.

For Elastic Stack versions 7.5 and below, use these steps to restore a snapshot:

  1. List the available snapshots, and click on the timestamp link of a snapshot to see the snapshot details.
  2. Optional: In the Restore Snapshot section, specify how you want to restore the snapshot. If you do not specify any options, all the indices of the snapshot are restored on the Elasticsearch cluster where the snapshot was taken.

    Snapshot restore

    • In the Specify Indices field, you can limit which indices get restored by specifying an index pattern. For example, entering logstash-*,.kibana restores any indices starting with logstash- as well as the .kibana index. All other indices are ignored.
    • You might need to specify values in the Match and Replace with fields, if you restore to the same cluster, as you cannot restore to an index that already exists.
  1. Click Restore snapshot.

After the snapshot is restored, a brief message indicates that the operation was successful.