Restoring Backup of specific Indexes
External Elasticsearch contains multiple indexes, each used to store different types of data. To restore specific data, restore specific index or a set of indexes. To view the list of available indexes in the external Elasticsearch, use the following command:
GET _cat/indices
External Elasticsearch has the following indexes:
Index | Description |
gateway_tenant_assets | Specifies information related to all assets in API Gateway. It includes details about APIs, policies, and other required configurations. |
gateway_tenant_analytics | Specifies data related to API usage, performance, and metrics. It also provides information on traffic patterns, response times, and overall API health. |
gateway_tenant_audit_auditlogs | Specifies all significant events and actions within API Gateway. It includes details such as user access, policy enforcement, and security-related events. |
gateway_tenant_log | Specifies logs generated by API Gateway during its operation. These logs capture information about requests, responses, errors, and system events. |
gateway_tenant_cache_cachestatistics | Specifies cache-related statistics within the API Gateway. It provides insights into cache hits, misses, and efficiency. |
To restore specific indexes
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 command, 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_assests"
}
In this 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_assets to restore only the
API Gateway assets.
A sample command to restore specific indexes with default tenant is as follows:
curl -si -X POST -H "content-type:application/json" -d '{"indices": "gateway_default_assets"}' 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 restore includes indices matching the pattern
gateway_default_assets.
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_assets/_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 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.