Use OSS snapshots to copy user roles and Kibana visualizations from a source Elasticsearch cluster to a destination cluster.
Prerequisites
Object Storage Service (OSS) is activated and a Standard-class OSS bucket is created in the same region as your Elasticsearch clusters. For more information, see Activate OSS and Create a bucket.
Two Alibaba Cloud Elasticsearch clusters are created in the same region — one as the source cluster and one as the destination cluster. For version compatibility details, see Index compatibility.
The restore procedure differs between V7.X and V8.X clusters. This topic covers two paths: restoring from an Elasticsearch V7.10 snapshot to another V7.10 cluster, and restoring from an Elasticsearch V8.5 snapshot to another V8.5 cluster.
For cross-version compatibility, see Index compatibility.
Precautions
Run all commands in this topic from the Kibana console of the relevant cluster.
For Elasticsearch V8.0 and later, back up and restore system indexes and data streams using only the
_featuresAPI. For details, see Snapshot and restore.
Reuse user information including the roles assigned to a user in a source cluster for a destination cluster
Step 1: Prepare the environment
Log on to the Kibana console of the source Elasticsearch cluster. For more information, see Log on to the Kibana console.
Create a role named
cj_test_roleand a user namedkara, then assign thecj_test_rolerole to thekarauser. For more information, see Use the RBAC mechanism provided by Elasticsearch X-Pack to implement access control.
Step 2: Create a snapshot to back up data in the source Elasticsearch cluster
Log on to the Kibana console of the source Elasticsearch cluster. For more information, see Log on to the Kibana console.
-
Create a snapshot repository named
my_backupin the source cluster. The command varies depending on whether the cluster is Alibaba Cloud-hosted or self-managed.-
For an Alibaba Cloud-hosted cluster:
``
PUT _snapshot/my_backup/ { "type": "oss", "settings": { "endpoint": "http://oss-cn-hangzhou-internal.aliyuncs.com", "access_key_id": "xxxx", "secret_access_key": "xxxxxx", "bucket": "xxxxxx", "compress": true, "chunk_size": "500mb", "base_path": "snapshot/" } }`` -
For a self-managed V8.X cluster, first install the elasticsearch-repository-oss plug-in. For installation steps, see Install the elasticsearch-repository-oss plug-in. For plug-in details, see elasticsearch-repository-oss.
``
PUT /_snapshot/my_backup { "type": "oss", "settings": { "oss.client.endpoint": "oss-cn-shanghai.aliyuncs.com", "oss.client.access_key_id": "xxx", "oss.client.secret_access_key": "xxx", "oss.client.bucket": "xxxxxx", "oss.client.base_path":"snapshot/", "oss.client.compress": true } }``
Parameter
Description
endpoint
The internal endpoint of the OSS bucket. For more information, see Regions and endpoints.
access_key_id
The AccessKey ID of your account. For more information, see Obtain an AccessKey pair.
secret_access_key
The AccessKey secret of your account. For more information, see Obtain an AccessKey pair.
bucket
The name of the OSS bucket. For more information, see Create a bucket.
compress
Whether to compress snapshot data. Set to
trueto enable compression (applies only to index metadata, such as mappings and settings). Defaults tofalse.chunk_size
The maximum size of each part when uploading large data to OSS in multiple parts. Data exceeding this size rolls over to the next part.
base_path
The root directory for the repository. Defaults to the root. Specify a subdirectory to isolate snapshots — for example,
snapshot/myindex/. -
-
Create a snapshot for the source cluster. The command differs by cluster version.
-
For a V7.10 source cluster, run the following command to create a snapshot named
snapshot_1. In V7.10, user information (roles and assignments) is stored in the.kibana*and.security*system indexes. For parameter details, see Create snapshot API.``
PUT _snapshot/my_backup/snapshot_1 { "indices": ".kibana*,.security*", "ignore_unavailable": true, "include_global_state": true }`` -
For a V8.5 source cluster, run the following command to create a snapshot named
snapshot_1targeting only the security feature state. For parameter details, see Create snapshot API.``
PUT _snapshot/my_backup/snapshot_1 { "indices": "-*", "ignore_unavailable": true, "include_global_state": true, "feature_states": [ "security" ] }``
-
-
Verify that the snapshot was created successfully. Run the following command to query
snapshot_1in themy_backuprepository.GET _snapshot/my_backup/snapshot_1
Step 3: Restore data from the snapshot
Log on to the Kibana console of the destination Elasticsearch cluster. For more information, see Log on to the Kibana console.
-
Create a snapshot repository named
my_restorein the destination cluster, pointing to the same OSS bucket used in the source cluster.PUT _snapshot/my_restore { "type": "oss", "settings": { "endpoint": "http://oss-cn-hangzhou-internal.aliyuncs.com", "access_key_id": "[your_access_key_id]", "secret_access_key": "[your_secret_access_key]", "bucket": "[your_bucket_name]", "compress": true, "chunk_size": "500mb", "base_path": "snapshot/" } } -
Restore data from the snapshot to the destination cluster.
-
For a V7.10 source cluster, follow these steps. Closing system indexes temporarily disables cluster features — perform this only during off-peak hours or when the cluster is idle.
Closing
.kibana*makes the Kibana console unavailable. Closing.security*affects data security. Back up these indexes before proceeding.Back up data in these system indexes before closing them so you can recover if needed.
Close these indexes only during off-peak hours or when the cluster is not serving traffic.
If closing indexes via the Kibana console fails, use a terminal instead. For details, see Curl commands that you can use to manage an Elasticsearch cluster.
-
Close the
.kibana*and.security*system indexes in the destination cluster.``
POST /<index name>/_close`` -
Restore data from
snapshot_1to the destination cluster.``
POST /_snapshot/my_restore/snapshot_1/_restore { "indices": ".kibana*,.security*", "ignore_unavailable": true, "include_global_state": false }`` -
Reopen the
.kibana*and.security*system indexes immediately after the restore completes.``
POST /<index name>/_open``
-
For a V8.5 source cluster, run the following command in the Kibana console of the destination cluster to restore the security feature state from
snapshot_1.``
POST _snapshot/my_restore/snapshot_1/_restore { "feature_states": [ "security" ], "include_global_state": false, "indices": "-*" }``
-
-
Verify that user information was restored to the destination cluster.
In the upper-left corner of the Kibana console of the destination cluster, click the
icon. In the left-side navigation pane, choose Management > Stack Management.In the left-side navigation pane, click Users. On the Users page, confirm that the
karauser with thecj_test_rolerole exists. If the user appears, the restore was successful.

Reuse visualizations in a source Elasticsearch cluster for a destination Elasticsearch cluster
Step 1: Prepare the environment
Log on to the Kibana console of the source Elasticsearch cluster. For more information, see Log on to the Kibana console.
-
Add sample data. When Add data changes to View data, the dataset is loaded and Kibana automatically creates related visualizations.
On the Kibana console homepage, click Try sample data in the Get started by adding integrations section.
On the Sample data tab, click Other sample data sets.
In the Sample flight data card, click Add data.
NoteThis example uses an Elasticsearch V8.5 cluster. The steps for adding sample data may differ by Elasticsearch version — follow the prompts in your Kibana console.

Confirm that the visualizations exist in the source cluster. Click the
icon in the upper-left corner, then choose Analytics > Visualize Library. Confirm that visualizations such as [Flights] Destination Weather and [Flights] Delays & Cancellations are listed.
Step 2: Create a snapshot to back up data in the source Elasticsearch cluster
Log on to the Kibana console of the source Elasticsearch cluster. For more information, see Log on to the Kibana console.
-
Create a snapshot repository named
my_backupin the source cluster.-
For an Alibaba Cloud-hosted cluster:
``
PUT _snapshot/my_backup/ { "type": "oss", "settings": { "endpoint": "http://oss-cn-hangzhou-internal.aliyuncs.com", "access_key_id": "xxxx", "secret_access_key": "xxxxxx", "bucket": "xxxxxx", "compress": true, "chunk_size": "500mb", "base_path": "snapshot/" } }`` -
For a self-managed V8.X cluster, install the elasticsearch-repository-oss plug-in first. For installation steps, see Install the elasticsearch-repository-oss plug-in. For plug-in details, see elasticsearch-repository-oss.
``
PUT /_snapshot/my_backup { "type": "oss", "settings": { "oss.client.endpoint": "oss-cn-shanghai.aliyuncs.com", "oss.client.access_key_id": "xxx", "oss.client.secret_access_key": "xxx", "oss.client.bucket": "xxxxxx", "oss.client.base_path":"snapshot/", "oss.client.compress": true } }``
Parameter
Description
endpoint
The internal endpoint of the OSS bucket. For more information, see Regions and endpoints.
access_key_id
The AccessKey ID of your account. For more information, see Obtain an AccessKey pair.
secret_access_key
The AccessKey secret of your account. For more information, see Obtain an AccessKey pair.
bucket
The name of the OSS bucket. For more information, see Create a bucket.
compress
Whether to compress snapshot data. Set to
trueto enable compression (applies only to index metadata, such as mappings and settings). Defaults tofalse.chunk_size
The maximum size of each part when uploading large data to OSS in multiple parts. Data exceeding this size rolls over to the next part.
base_path
The root directory for the repository. Defaults to the root. Specify a subdirectory to isolate snapshots — for example,
snapshot/myindex/. -
-
Create a snapshot for the source cluster. The command differs by cluster version.
-
For a V7.10 source cluster, run the following command to create a snapshot named
snapshot_2. For parameter details, see Create snapshot API.``
PUT _snapshot/my_backup/snapshot_2 { "indices": ".kibana*,.security*", "ignore_unavailable": true, "include_global_state": true }`` -
For a V8.5 source cluster, run the following command to create a snapshot named
snapshot_2targeting both the security and Kibana feature states. For parameter details, see Create snapshot API.``
PUT _snapshot/my_backup/snapshot_2 { "indices": "-*", "ignore_unavailable": true, "include_global_state": true, "feature_states": [ "security","kibana" ] }``
-
-
Verify that the snapshot was created successfully. Run the following command to query
snapshot_2in themy_backuprepository.GET _snapshot/my_backup/snapshot_2
Step 3: Restore data from the snapshot
Log on to the Kibana console of the destination Elasticsearch cluster. For more information, see Log on to the Kibana console.
-
Create a snapshot repository named
my_restorein the destination cluster, pointing to the same OSS bucket used in the source cluster.PUT _snapshot/my_restore { "type": "oss", "settings": { "endpoint": "http://oss-cn-hangzhou-internal.aliyuncs.com", "access_key_id": "[your_access_key_id]", "secret_access_key": "[your_secret_access_key]", "bucket": "[your_bucket_name]", "compress": true, "chunk_size": "500mb", "base_path": "snapshot/" } } -
Restore data from the snapshot to the destination cluster.
-
For a V7.10 source cluster, follow these steps. Closing system indexes temporarily disables cluster features — perform this only during off-peak hours or when the cluster is idle.
Closing
.kibana*makes the Kibana console unavailable. Closing.security*affects data security. Back up these indexes before proceeding.Back up data in these system indexes before closing them so you can recover if needed.
Close these indexes only during off-peak hours or when the cluster is not serving traffic.
If closing indexes via the Kibana console fails, use a terminal instead. For details, see Curl commands that you can use to manage an Elasticsearch cluster.
-
Close the
.kibana*and.security*system indexes in the destination cluster.``
POST /<index name>/_close`` -
Restore data from
snapshot_2to the destination cluster.``
POST /_snapshot/my_restore/snapshot_2/_restore { "indices": ".kibana*,.security*", "ignore_unavailable": true, "include_global_state": false }`` -
Reopen the
.kibana*and.security*system indexes immediately after the restore completes.``
POST /<index name>/_open``
-
For a V8.5 source cluster, run the following command in the Kibana console of the destination cluster to restore both the security and Kibana feature states from
snapshot_2.``
POST _snapshot/my_restore/snapshot_2/_restore { "feature_states": [ "security","kibana" ], "include_global_state": false, "indices": "-*" }``
-
Verify that the visualizations are available in the destination cluster. Click the
icon in the upper-left corner of the Kibana console, then choose Analytics > Visualize Library. Confirm that the visualizations from the source cluster appear on the Visualize Library page.