API Gateway 11.1 | Administering API Gateway | Operating API Gateway | Data Management | Data Backup | Restore Operation | Restoring External Elasticsearch Backup
 
Restoring External Elasticsearch Backup
Restoring data from backup snapshots involves a series of steps to ensure that the indices are properly closed before the restore operation and reopened afterward. Additionally, clearing internal caches and restarting the API Gateway server is recommended to ensure the restored data is fully integrated.
*To restore external Elasticsearch
1. Ensure your external Elasticsearch cluster is up and running.
2. Close the indices to be restored.
A sample command to close all the indices is as follows:
curl -si -X POST "http://es-host:es-port/gateway_tenant_name_*/_close"
In this example, the external Elasticsearch cluster is assumed to be running on es-host with port es-port.
3. Restore the indices from the snapshot using the external Elasticsearch API.
POST _snapshot/repo-name/backup-name_restore?wait_for_completion={true/false}
{
"indices": "gateway_tenant_*"
}
In the external Elasticsearch API:
*Replace repo-name with the name of the backup repository.
*Replace backup-name with the name of the snapshot to restore.
*wait_for_completion is a query parameter indicating whether the request must wait for the restore operation 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 restore. In this example, it includes indices matching the pattern gateway_tenant_*. Replace tenant with the appropriate tenant name.
A sample command to restore external Elasticsearch 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/_restore?wait_for_completion=true
In this example:
*The external Elasticsearch cluster is assumed to be running on es-host with port es-port.
*The backup repository name is myrepo.
*The snapshot api_data_store_backup is restored for indices matching the pattern gateway_default_*.
*The request immediately returns a response, while the restore operation runs in the background.
4. Reopen the indices after the restore operation is complete.
A sample command to open the indices is as follows:
curl -si -X POST "http://es-host:es-port/gateway_tenant_name_*/_open"
In this example, the external Elasticsearch cluster is assumed to be running on es-host with port es-port.
5. Verify the status of the restore operation.
If you have triggered a restore operation with wait_for_completion=true, you can determine the current status of the restore 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.
The JSON response from the external Elasticsearch provides detailed information about the status of the restore operation.
6. Restart the API Gateway server to clear all internal caches and ensure the restored data is fully integrated.