All Products
Search
Document Center

Elasticsearch:Reuse user information and visualizations between Elasticsearch clusters

Last Updated:Jun 03, 2026

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.

Note
  • 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 _features API. 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

  1. Log on to the Kibana console of the source Elasticsearch cluster. For more information, see Log on to the Kibana console.

  2. Create a role named cj_test_role and a user named kara, then assign the cj_test_role role to the kara user. 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

  1. Log on to the Kibana console of the source Elasticsearch cluster. For more information, see Log on to the Kibana console.

  2. Create a snapshot repository named my_backup in 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 true to enable compression (applies only to index metadata, such as mappings and settings). Defaults to false.

    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/.

  3. 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_1 targeting 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" ] } ``

  4. Verify that the snapshot was created successfully. Run the following command to query snapshot_1 in the my_backup repository.

       GET _snapshot/my_backup/snapshot_1

Step 3: Restore data from the snapshot

  1. Log on to the Kibana console of the destination Elasticsearch cluster. For more information, see Log on to the Kibana console.

  2. Create a snapshot repository named my_restore in 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/"
         }
       }
  3. 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.

      1. Close the .kibana* and .security* system indexes in the destination cluster.

        `` POST /<index name>/_close ``

      2. Restore data from snapshot_1 to the destination cluster.

        `` POST /_snapshot/my_restore/snapshot_1/_restore { "indices": ".kibana*,.security*", "ignore_unavailable": true, "include_global_state": false } ``

      3. 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": "-*" } ``

  4. Verify that user information was restored to the destination cluster.

    1. In the upper-left corner of the Kibana console of the destination cluster, click the menu icon. In the left-side navigation pane, choose Management > Stack Management.

    2. In the left-side navigation pane, click Users. On the Users page, confirm that the kara user with the cj_test_role role exists. If the user appears, the restore was successful.

    User verification

Reuse visualizations in a source Elasticsearch cluster for a destination Elasticsearch cluster

Step 1: Prepare the environment

  1. Log on to the Kibana console of the source Elasticsearch cluster. For more information, see Log on to the Kibana console.

  2. Add sample data. When Add data changes to View data, the dataset is loaded and Kibana automatically creates related visualizations.

    1. On the Kibana console homepage, click Try sample data in the Get started by adding integrations section.

    2. On the Sample data tab, click Other sample data sets.

    3. In the Sample flight data card, click Add data.

    Note

    This 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.

    Sample data added

  3. Confirm that the visualizations exist in the source cluster. Click the menu 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

  1. Log on to the Kibana console of the source Elasticsearch cluster. For more information, see Log on to the Kibana console.

  2. Create a snapshot repository named my_backup in 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 true to enable compression (applies only to index metadata, such as mappings and settings). Defaults to false.

    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/.

  3. 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_2 targeting 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" ] } ``

  4. Verify that the snapshot was created successfully. Run the following command to query snapshot_2 in the my_backup repository.

       GET _snapshot/my_backup/snapshot_2

Step 3: Restore data from the snapshot

  1. Log on to the Kibana console of the destination Elasticsearch cluster. For more information, see Log on to the Kibana console.

  2. Create a snapshot repository named my_restore in 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/"
         }
       }
  3. 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.

      1. Close the .kibana* and .security* system indexes in the destination cluster.

        `` POST /<index name>/_close ``

      2. Restore data from snapshot_2 to the destination cluster.

        `` POST /_snapshot/my_restore/snapshot_2/_restore { "indices": ".kibana*,.security*", "ignore_unavailable": true, "include_global_state": false } ``

      3. 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": "-*" } ``

  4. Verify that the visualizations are available in the destination cluster. Click the menu 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.