Creating Elasticsearch Backup

After you have configured the backup repositories, you can create backup of your Elasticsearch. Creating a backup does not require the webMethods API Gateway server to be active.

Pre-requisites

Ensure that you configure a repository to store your backup files. For information about creating and configuring a repository, see Backup Repository.

To create a backup

  1. Ensure your Elasticsearch cluster is up and running.
  2. Create the backup using the Elasticsearch API.
    POST  _snapshot/repo-name/backup-name?wait_for_completion={true/false}
    {
       "indices": "gateway_tenant_*"
    }

    In this Elasticsearch API:

    • Replace repo-name with the name of the backup repository where the backup is stored.
    • Replace backup-name with the name of the backup being created.
    • wait_for_completion is a query parameter indicating whether the request must wait for the backup to complete before responding. It can be set to either true or false. The default value is false.
    • indices specifies the indices you want to include in the backup. In this example, it includes indices matching the pattern gateway_tenant_*. Replace tenant with the appropriate tenant name.
    A sample command to create an entire webMethods API Gateway Elasticsearch backup with default tenant is as follows:
    curl -si -X POST -H "content-type:application/json" -d '{"indices": "gateway_default_*"}' http://es-host:es-port/_snapshot/myrepo/api_data_store_backup?wait_for_completion=false
    

    In this example:

    • The Elasticsearch cluster is assumed to be running on es-host with port es-port.
    • The backup repository myrepo creates a backup named api_data_store_backup.
    • The backup includes indices matching the pattern gateway_default_*.
    • The request immediately returns a response, while the backup operation runs in the background.
  3. Verify the status of the backup operation using the following command:
    GET _snapshot/repo-name/backup-name/_status

    In this command, replace repo-name and backup-name with your repository and backup names, respectively.

    A sample command to verify the backup status is as follows:
    curl -s -X GET http://es-host:es-port/_snapshot/myrepo/api_data_store_backup/_status

    In this example:

    • The Elasticsearch cluster is assumed to be running on es-host with port es-port.
    • The command queries the status of the backup named api_data_store_backup in the backup repository myrepo.

    The JSON response from the Elasticsearch provides detailed information about the status of the backup.