All Products
Search
Document Center

Elasticsearch:Reuse user and visualization information across Elasticsearch clusters

Last Updated:Aug 21, 2026

If you want to reuse information of a user, such as the roles assigned to the user, or information of visualizations in a source Elasticsearch cluster for a destination Elasticsearch cluster, you can create manual snapshots to back up the information, and restore the information from the manual snapshots to the destination Elasticsearch cluster.

Prerequisites

  • Object Storage Service (OSS) is activated. An OSS bucket whose storage class is Standard is created. For more information, see Activate OSS and Create a bucket.

  • Two Alibaba Cloud Elasticsearch clusters are created in the region in which the OSS bucket resides. One Elasticsearch cluster is used as the source cluster, and the other is used as the destination cluster. For information about the compatibility between Elasticsearch clusters of different versions in the aspect of data restoration from snapshots, see Index compatibility.

    Note
    • The operations for restoring data from snapshots created for an Elasticsearch V8.X cluster are different from the operations for restoring data from snapshots created for an Elasticsearch V7.X cluster. This topic describes how to restore data from a snapshot created for an Elasticsearch V7.10 cluster to another Elasticsearch V7.10 cluster and how to restore data from a snapshot created for an Elasticsearch V8.5 cluster to another Elasticsearch V8.5 cluster.

    • For information about the compatibility between Elasticsearch clusters of different versions in the aspect of data restoration from snapshots, see Index compatibility.

Precautions

  • You can run the code provided in this topic in the Kibana consoles of your Elasticsearch clusters.

  • You can use only the _features API to back up and restore system indexes and system data streams for Elasticsearch clusters of V8.0 and later. For more information about the _features API, 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 in the source Elasticsearch cluster, and assign the cj_test_role role to the kara user. For more information, see Manage user permissions with X-Pack roles.

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 repository named my_backup in the source Elasticsearch cluster. For more information, see Create a snapshot repository.

  3. Create a snapshot for the source Elasticsearch cluster.

    • If the source Elasticsearch cluster is of V7.10, run the following command to create a snapshot named snapshot_1 for the cluster.

      Note

      The information of a user, such as the roles assigned to the user, in an Elasticsearch V7.10 cluster is managed by using the .kibana* and .security* system indexes.

      For information about the parameters in the command that is used to create a snapshot for an Elasticsearch V7.10 cluster, see Restore snapshot API.

      PUT _snapshot/my_backup/snapshot_1
      {
       "indices": ".kibana*,.security*",
       "ignore_unavailable": true,
       "include_global_state": true
      }
    • If the source Elasticsearch cluster is of V8.5, run the following command to create a snapshot named snapshot_1 for the indexes that store information of the user, such as the role assigned to the user, in the cluster.

      Note

      For information about the parameters in the command that is used to create a snapshot for an Elasticsearch V8.5 cluster, see Create snapshot API.

      PUT _snapshot/my_backup/snapshot_1
      {
       "indices": "-*",
       "ignore_unavailable": true,
       "include_global_state": true,
       "feature_states": [
       "security"
       ]
      }
  4. Check whether the snapshot is successfully created. For example, you can run the following command to query the details of the snapshot_1 snapshot 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 repository named my_restore in the destination Elasticsearch 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 that is created for the source Elasticsearch cluster to the destination Elasticsearch cluster.

    • If the source Elasticsearch cluster is of V7.10, perform the following operations to restore data from the snapshot created for the cluster.

      Note

      If you want to restore data from a snapshot created for an Elasticsearch cluster of V7.10 or earlier to a destination Elasticsearch cluster, you must disable the .kibana* and .security* system indexes in the destination Elasticsearch cluster. After data is restored from the snapshot, you must enable these indexes at the earliest opportunity.

      • Disabling system indexes may cause the features of the Elasticsearch cluster to be unavailable or limited. For example, disabling of .kibana* system indexes may cause the Kibana console to be unavailable, and disabling of .security* system indexes may affect the data security of the Elasticsearch cluster.

      • We recommend that you back up data in these system indexes in advance. This way, you can restore the data if necessary.

      • We recommend that you disable these indexes in the destination Elasticsearch cluster during off-peak hours or when the cluster is not providing services.

      • If you cannot disable these indexes in the Kibana console of the destination Elasticsearch cluster, we recommend that you use a terminal to disable these indexes. For more information, see Curl commands that you can use to manage an Elasticsearch cluster.

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

        POST /<index name>/_close
      2. Restore data from the snapshot_1 snapshot to the destination Elasticsearch cluster.

        POST /_snapshot/my_restore/snapshot_1/_restore
        {
         "indices": ".kibana*,.security*",
         "ignore_unavailable": true,
         "include_global_state": false
        }
      3. Enable the .kibana* and .security* system indexes in the destination Elasticsearch cluster.

        POST /<index name>/_open
    • If the source Elasticsearch cluster is of V8.5, run the following command in the Kibana console of the destination Elasticsearch cluster to restore data from the snapshot_1 snapshot to the destination Elasticsearch cluster.

      POST _snapshot/my_restore/snapshot_1/_restore
      {
       "feature_states": [ "security" ],
       "include_global_state": false, 
       "indices": "-*" 
      }
  4. Check whether the user information is reused for the destination Elasticsearch cluster.

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

    2. In the left-side navigation pane, choose Security > Users. On the Users page, check whether the kara user to which the cj_test_role role is assigned exists. If the user exists, information of the kara user is reused for the destination Elasticsearch cluster.

      image.png

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.

    Note

    In this example, sample data is added to an Elasticsearch V8.5 cluster. The operations for adding sample data to an Elasticsearch cluster may vary based on the Elasticsearch version. You can perform the operations that are required in the Kibana console.

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

    2. On the Sample data tab of the page that appears, click Other sample data sets.

    3. Click Add data in the Sample flight data card.

      If Add data changes to View Data, the datasets are added. After the dataset is added, Kibana automatically creates some related visualizations.

      image.png

  3. In the upper-left corner of the Kibana console, click the 菜单.png icon. In the left-side navigation pane, choose Analytics > Visualize Library to view visualizations such as [Flights] Destination Weather and [Flights] Delays & Cancellations.

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 repository named my_backup in the source Elasticsearch cluster. For more information, see Create a snapshot repository.

  3. Create a snapshot for the source Elasticsearch cluster.

    • If the source Elasticsearch cluster is of V7.10, run the following command to create a snapshot named snapshot_2 in the cluster.

      Note

      For information about the parameters in the command that is used to create a snapshot for an Elasticsearch V7.10 cluster, see Restore snapshot API.

      PUT _snapshot/my_backup/snapshot_2
      {
       "indices": ".kibana*,.security*",
       "ignore_unavailable": true,
       "include_global_state": true
      }
    • If the source Elasticsearch cluster is of V8.5, run the following command to create a snapshot named snapshot_2 for the indexes that store visualizations in the cluster.

      Note

      For information about the parameters in the command that is used to create a snapshot for an Elasticsearch V8.5 cluster, see Create snapshot API.

      PUT _snapshot/my_backup/snapshot_2
      {
        "indices": "-*",
        "ignore_unavailable": true,
        "include_global_state": true,
        "feature_states": [
            "security","kibana"
          ]
  4. Check whether the snapshot is successfully created. For example, you can run the following command to query the details of the snapshot_2 snapshot 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 repository named my_restore in the destination Elasticsearch 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 that is created for the source Elasticsearch cluster to the destination Elasticsearch cluster.

    • If the source Elasticsearch cluster is of V7.10, perform the following operations to restore data from the snapshot created for the cluster.

      Note

      If you want to restore data from a snapshot created for an Elasticsearch cluster of V7.10 or earlier to a destination Elasticsearch cluster, you must disable the .kibana* and .security* system indexes in the destination Elasticsearch cluster. After data is restored from the snapshot, you must enable these indexes at the earliest opportunity.

      • Disabling system indexes may cause the features of the Elasticsearch cluster to be unavailable or limited. For example, disabling of .kibana* system indexes may cause the Kibana console to be unavailable, and disabling of .security* system indexes may affect the data security of the Elasticsearch cluster.

      • We recommend that you back up data in these system indexes in advance. This way, you can restore the data if necessary.

      • We recommend that you disable these indexes in the destination Elasticsearch cluster during off-peak hours or when the cluster is not providing services.

      • If you cannot disable these indexes in the Kibana console of the destination Elasticsearch cluster, we recommend that you use a terminal to disable these indexes. For more information, see Curl commands that you can use to manage an Elasticsearch cluster.

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

        POST /<index name>/_close
      2. Restore data from the snapshot_2 snapshot to the destination Elasticsearch cluster.

        POST /_snapshot/my_restore/snapshot_2/_restore
        {
         "indices": ".kibana*,.security*",
         "ignore_unavailable": true,
         "include_global_state": false
        }
      3. Enable the .kibana* and .security* system indexes in the destination Elasticsearch cluster.

        POST /<index name>/_open
    • If the source Elasticsearch cluster is of V8.5, run the following command in the Kibana console of the destination Elasticsearch cluster to restore data from the snapshot_2 snapshot to the destination Elasticsearch cluster.

      POST _snapshot/my_restore/snapshot_2/_restore
      {
        "feature_states": [ "security","kibana" ],
        "include_global_state": false,    
        "indices": "-*"                   
      }
  4. Check whether the visualizations are reused for the destination Elasticsearch cluster.

    In the upper-left corner of the Kibana console of the destination Elasticsearch cluster, click the 菜单.png icon. In the left-side navigation pane, choose Analytics > Visualize Library. On the Visualize Library page, check whether the visualizations are reused for the destination Elasticsearch cluster.