Guides / Sending and managing data / Manage indices and apps / Manage indices

You can copy (duplicate) or move (rename) indices, including their associated records, settings, synonyms, and rules, using the Algolia dashboard or the API.

Copying or moving an index doesn’t move the associated analytics data.

Copying or moving an index is resource-intensive and rate-limited.

Move or rename indices

You can move or rename an index within the same Algolia application in the Algolia dashboard or with an API client.

Rename indices in the Algolia dashboard

  1. Go to the Algolia dashboard and select your Algolia application.
  2. On the left sidebar, select Algolia Search Search.
  3. Select your Algolia index:

    Select your Algolia application and index

  4. Select Manage index > Rename.

    Rename or move an index from the Algolia dashboard.

    The Rename option only shows if you selected a primary index. It doesn’t show for replica indices.

  5. Enter the current and new index names and click Rename.

    If an index with the new name already exists, it’s overwritten.

Rename indices with an API client

To rename or move an index with the API, you can use:

You can’t move an index between different Algolia applications but you can create a copy and delete the original index. For more information, see Copy indices between apps.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Algolia.Search.Clients;
using Algolia.Search.Http;
using Algolia.Search.Models.Search;

var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));

var response = await client.OperationIndexAsync(
  "<SOURCE_INDEX_NAME>",
  new OperationIndexParams
  {
    Operation = Enum.Parse<OperationType>("Move"),
    Destination = "<DESTINATION_INDEX_NAME>",
  }
);

If an index with the new name already exists, moving overwrites it. To avoid overwriting existing indices, check if an index exists with the indexExists helper.

If the source index doesn’t exist, Algolia ignores the move operation.

Renaming an index doesn’t change the associated analytics:

  • Analytics associated with the original index keep their name.
  • A new set of analytics is started with the new name.

For more information, see Indices and analytics.

Indices with replicas

Renaming replica indices requires several steps.

You can’t move a source index with replicas.

You can move an index to a destination index with replicas. First, the source index data replaces the destination index data. Then, the data is copied to the replicas.

Indices used as a Recommend data source

If an index is the data source for Recommend models, you can’t rename it directly. If you do, you’ll lose the relationship between the recommended records and their source.

Instead:

  1. Copy the index.
  2. To keep the events you already collected, train a new model on the copy index using the old index as an additional events source.
  3. After training, switch your apps and services to use the new index.
  4. Delete the old index and the old model (from the Algolia dashboard).

Copy indices

You can copy an index in the Algolia dashboard or with an API client but be aware that:

  • Copying an index duplicates the records and configuration, including synonyms and rules of an existing index (except the enableReRanking setting).
  • Copying an index doesn’t create a replica. The new index is an independent copy.
  • To copy an index between two Algolia applications, you must use the API.

Copy indices in the Algolia dashboard

  1. Go to the Algolia dashboard and select your Algolia application.
  2. On the left sidebar, select Algolia Search Search.
  3. Select your Algolia index:

    Select your Algolia application and index

  4. Select Manage index > Duplicate.

    Duplicate your index, including settings, rules, and synonyms.

  5. Select Create a new index or Overwrite an existing index and enter the destination index name.
  6. If you’re overwriting an existing index, enter DUPLICATE to confirm.
  7. Click Duplicate.

Copy indices with an API client

To copy indices, you can use:

Provide a scope parameter to choose what you want to copy: records, settings, synonyms, or rules.

Copy indices fully

To copy an index including records, settings, synonyms, and rules:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Algolia.Search.Clients;
using Algolia.Search.Http;
using Algolia.Search.Models.Search;

var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));

var response = await client.OperationIndexAsync(
  "<SOURCE_INDEX_NAME>",
  new OperationIndexParams
  {
    Operation = Enum.Parse<OperationType>("Copy"),
    Destination = "<DESTINATION_INDEX_NAME>",
  }
);
  • If the source index doesn’t exist, an empty index is created.
  • If an index with this name already exists, it will be overwritten.

To prevent overwriting existing indices, check if an index exists with the indexExists helper.

Copy indices partially

To copy parts of an index, use the scope parameter of the operationIndex method. For example, to copy only the synonyms and settings between indices, but not records or rules:

1
2
3
4
5
6
7
8
9
10
11
12
13
var response = await client.OperationIndexAsync(
  "<SOURCE_INDEX_NAME>",
  new OperationIndexParams
  {
    Operation = Enum.Parse<OperationType>("Move"),
    Destination = "<DESTINATION_INDEX_NAME>",
    Scope = new List<ScopeType>
    {
      Enum.Parse<ScopeType>("Rules"),
      Enum.Parse<ScopeType>("Settings"),
    },
  }
);

If you use the scope parameter, records aren’t copied to the new index. Existing items of the scope are replaced. Items belonging to other scopes are preserved. For example, if you use the settings scope, only the settings are copied to the destination index, keeping the records, synonyms, and rules.

Indices with replicas

Copying a source index that has replicas copies the index’s data, but not its replicas. The destination index won’t have replicas.

You can’t copy to a destination index with replicas.

Copy indices between different applications

To copy an index between different Algolia applications, use the Algolia CLI.

Did you find this page helpful?