Would you like to learn how to create an ElasticSearch Snapshot? In this tutorial, we are going to show you how to create the Snapshot of an ElasticSearch index on a computer running Ubuntu Linux.

• Ubuntu 18
• Ubuntu 19
• Ubuntu 20
• ElasticSearch 7.6.2

In our example, The ElastiSearch server IP address is 192.168.100.7.

Important! The Elasticsearch uses the word Index instead of the word Table.

Tutorial ElasticSearch – Creating a Snapshot

Install the required packages.

Copy to Clipboard

Test your communication with the ElasticSearch server.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Stop the ElasticSearch service.

Copy to Clipboard

Create a local directory to store the Snapshot.

Copy to Clipboard

Edit the ElasticSearch configuration file named: elasticsearch.yml

Copy to Clipboard

Add the following line at the end of the file.

Copy to Clipboard

Here is the original file, before our configuration.

Copy to Clipboard

Here is the file with our configuration.

Copy to Clipboard

Start the ElasticSearch service.

Copy to Clipboard

Register a new Snapshot repository named BACKUP.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

List all Snapshot repositories.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Create a Snapshot of the ElasticSearch database.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, we created a snapshot named SNAPSHOT_001.

In our example, we stored this snapshot inside the repository named: BACKUP.

This Snapshot stores all the Elasticsearch information.

To create a Snapshot of a specific ElasticSearch index, use the following command.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, we created a snapshot named SNAPSHOT_INDEX_ACCOUNT_001.

In our example, we stored this snapshot inside the repository named: BACKUP.

This Snapshot stores only the index named ACCOUNTS.

List all Snapshots available on the repository named BACKUP.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Use this command to list information from a specific Snapshot.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, we listed the information from a Snapshot named SNAPSHOT_001 that was stored on the repository named BACKUP.

Congratulations! You created an ElasticSearch Snapshot.

Tutorial ElasticSearch – Restoring a Snapshot

Install the required packages.

Copy to Clipboard

Test your communication with the ElasticSearch server.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Restore the ElasticSearch Snapshot named: SNAPSHOT_INDEX_ACCOUNT_001

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, we restored the backup of an Elasticsearch index named ACCOUNTS.

If you received the following error message, you need to close the ElasticSearch index before restoring the Snapshot.

Copy to Clipboard

To close the Elasticsearch index, use the following command.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Congratulations! You restored the ElasticSearch Snapshot.