Help Center/ Cloud Search Service/ FAQs/ Using CSS Cluster Search Engines/ How Do I Change the Number of Replicas for Elasticsearch Indexes in CSS?
Updated on 2024-09-14 GMT+08:00

How Do I Change the Number of Replicas for Elasticsearch Indexes in CSS?

When creating an index for an Elasticsearch cluster, you can specify the number of shards, that is, the number of primary shards. Once an index is created, the number of primary shards cannot be changed, but the number of replicas can. Number of replica shards = Number of primary shards x Number of replicas.

You can change the number of index replicas of an Elasticsearch cluster in Kibana.

  1. Log in to the CSS management console.
  2. In the navigation pane on the left, choose Clusters > Elasticsearch.
  3. Locate the target cluster, and click Access Kibana in the Operation column to log in to Kibana.
  4. Click Dev Tools in the navigation tree on the left.
  5. On the Kibana console, run the following command to check the number of replicas for each Elasticsearch index:
    GET _cat/indices?v
    Figure 1 Checking the number of replicas
  6. Run the following command to configure the number of index replicas:
    PUT /indexname/_settings
    {
      "number_of_replicas" :1       //Number of replicas
    }

    indexname indicates the name of the index to be modified, and number_of_replicas indicates the number of replicas to be set.