> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage multiple indices

> Copying index settings to replicas and other indices.

export const Index = () => <Tooltip tip="An Algolia index is a searchable dataset that consists of records and configuration settings. These settings define how the records are searched and ranked.">
    index
  </Tooltip>;

It's common to have several replica indices that differ from their primary  <Index /> by a single setting, such as the sorting strategy.
Products in an ecommerce store are a good example. You may have a primary index sorted by ascending price, and one or more replicas that sort products by descending price, descending popularity, descending rating, and so on.

Despite these different sorting settings, **you may still want to copy settings from one index to its replicas or other indices**. For example, if you decide to change the [`searchableAttributes`](/doc/api-reference/api-parameters/searchableAttributes) setting, you probably want it to apply to all indices.

The `forwardToReplicas` parameter lets you forward new settings to replicas.
From there, you can change only the settings that need to be different and keep all others synchronized.

## Example of multiple indices

You have a primary index called `products` and a `products_price_desc` replica.
Both indices have the same data and settings,
apart from the [`ranking`](/doc/api-reference/api-parameters/ranking) setting.

If you want to change the [`searchableAttributes`](/doc/api-reference/api-parameters/searchableAttributes) setting to include a new `description` attribute for all indices, primary and replicas, use the `forwardToReplicas` parameter.

## Using the API

The [`setSettings`](/doc/libraries/sdk/methods/search/set-settings),
synonyms, and Rules methods, have a `forwardToReplicas` parameter.
Ry default, `forwardToReplicas` is `false`, so any setting, synonym,
or rule change only applies to the target index.
By setting it to `true`, you can forward these changes to all the replicas belonging to the index you target.

To run the code examples on this page, [install the latest API client](/doc/libraries/sdk/install).

<CodeGroup>
  ```cs C# theme={"system"}
  var response = await client.SetSettingsAsync(
    "INDEX_NAME",
    new IndexSettings
    {
      SearchableAttributes = new List<string> { "name", "description" },
    },
    true
  );
  ```

  ```dart Dart theme={"system"}
  final response = await client.setSettings(
    indexName: "INDEX_NAME",
    indexSettings: IndexSettings(
      searchableAttributes: [
        "name",
        "description",
      ],
    ),
    forwardToReplicas: true,
  );
  ```

  ```go Go theme={"system"}
  response, err := client.SetSettings(client.NewApiSetSettingsRequest(
    "INDEX_NAME",
    search.NewEmptyIndexSettings().SetSearchableAttributes(
      []string{"name", "description"})).WithForwardToReplicas(true))
  if err != nil {
    // handle the eventual error
    panic(err)
  }
  ```

  ```java Java theme={"system"}
  UpdatedAtResponse response = client.setSettings(
    "INDEX_NAME",
    new IndexSettings().setSearchableAttributes(Arrays.asList("name", "description")),
    true
  );
  ```

  ```js JavaScript theme={"system"}
  const response = await client.setSettings({
    indexName: 'theIndexName',
    indexSettings: { searchableAttributes: ['name', 'description'] },
    forwardToReplicas: true,
  });
  ```

  ```kotlin Kotlin theme={"system"}
  var response =
    client.setSettings(
      indexName = "INDEX_NAME",
      indexSettings = IndexSettings(searchableAttributes = listOf("name", "description")),
      forwardToReplicas = true,
    )
  ```

  ```php PHP theme={"system"}
  $response = $client->setSettings(
      'INDEX_NAME',
      ['searchableAttributes' => [
          'name',

          'description',
      ],
      ],
      true,
  );
  ```

  ```python Python theme={"system"}
  response = client.set_settings(
      index_name="INDEX_NAME",
      index_settings={
          "searchableAttributes": [
              "name",
              "description",
          ],
      },
      forward_to_replicas=True,
  )
  ```

  ```ruby Ruby theme={"system"}
  response = client.set_settings(
    "INDEX_NAME",
    Algolia::Search::IndexSettings.new(searchable_attributes: ["name", "description"]),
    true
  )
  ```

  ```scala Scala theme={"system"}
  val response = Await.result(
    client.setSettings(
      indexName = "INDEX_NAME",
      indexSettings = IndexSettings(
        searchableAttributes = Some(Seq("name", "description"))
      ),
      forwardToReplicas = Some(true)
    ),
    Duration(100, "sec")
  )
  ```

  ```swift Swift theme={"system"}
  let response = try await client.setSettings(
      indexName: "INDEX_NAME",
      indexSettings: IndexSettings(searchableAttributes: ["name", "description"]),
      forwardToReplicas: true
  )
  ```
</CodeGroup>

<Note>
  Settings are only forwarded to existing replicas.
  If you want to forward settings and create a replica, you first have to create the replica and forward the settings after. These must be separate operations.
</Note>

## Using the dashboard

Whenever you make settings changes,
Algolia's dashboard prompts you to review them before saving and gives you the option to **Copy these settings to other indices and replicas**.

**Whenever you copy settings changes to indices, you replace the previous setting on the index.**
For example, if you change the ranking formula on the primary index to include a sort on an `inventory` attribute,
and then choose to copy the updated [`ranking`](/doc/api-reference/api-parameters/ranking) setting to all replicas,
you overwrite any previously set sorts on other attributes on the replicas.

When altering the ranking formula on indices with replicas,
you are recommended to do it on a per index basis.

While [`customRanking`](/doc/api-reference/api-parameters/customRanking) is part of the ranking formula,
it's a setting as well. You can alter the custom ranking and forward the change to your replicas without worrying about overwriting the entire ranking formula.

**You usually don't need to worry about overwriting settings,
since you typically want most settings to be the same between replicas.**
Notable exceptions include [`ranking`](/doc/api-reference/api-parameters/ranking) and [`typoTolerance`](/doc/api-reference/api-parameters/typoTolerance).

### Copy synonyms and rules

You can import and export synonyms and rules [from the Algolia dashboard](/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/export-import-indices).
