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

You can copy, or, duplicate whole indices, including records, settings, synonyms, and Rules. You can copy indices within an Algolia application from the dashboard and the API. If you want to copy an index between two Algolia applications, you can use the API. For more information, see Copy indices between applications on this page.

Copying an index doesn’t copy the associated analytics data.

Copying an index is an expensive operations and is rate-limited.

Copy indices from the Algolia dashboard

Copying an index duplicates the records and configuration, including synonyms and Rules of an existing index (except the enableReRanking setting).

To copy or duplicate an index in the dashboard:

  1. Go to the Algolia dashboard and select your index from the Index menu.
  2. Select Manage index > Duplicate.

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

  3. Select Create a new index and enter a new index name, if you want to copy an index to a new index. Select Overwrite an existing index and enter an existing index name to overwrite an existing index.

    Select if you want to create a new index or overwrite an existing index

  4. Enter DUPLICATE to confirm (if you’re overwriting an existing index) and click Duplicate.

Copy indices using the API

To copy indices, use the copyIndex method. By providing a scope parameter, you can choose what you want to copy: records, settings, synonyms, or Rules.

Copying an index has no impact on Analytics, because you can’t copy an index’s analytics data. The API keys of the source are merged with the existing keys in the destination index.

Copy indices fully

To copy an index including records, settings, synonyms, and Rules, use the copyIndex method without arguments:

// Copy indexNameSrc to indexNameDest
$res = $client->copyIndex('indexNameSrc', 'indexNameDest');

If an index with the new name already exists, it’s overwritten after the renaming. To prevent accidentally overwriting existing indices, you can check if an index exists with the indexExists method.

If the source index doesn’t exist, copyIndex creates an empty index with zero records under the new name. To prevent this, you can also use the indexExists method to see if the source index exists before copying.

Copy indices partially

To copy parts of an index, you can use the scope parameter. For example, to copy only the synonyms and settings (but not records or Rules) between indices:

// Copy settings and synonyms (but not rules, nor records) from indexNameSrc to indexNameDest
$res = $client->copyIndex('indexNameSrc', 'indexNameDest', [
  'scope' => ['settings', 'synonyms']

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.

See Scopes for more information.

Copying 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 that already has replicas.

Copy indices between different applications

To copy an index between different Algolia applications, use the AccountClient, which is part of the Algolia API clients.

For JavaScript, the AccountClient is distributed as a separate package @algolia/client-account. You can install it from npm:

npm install @algolia/client-account
$index1 = \Algolia\AlgoliaSearch\SearchClient::create('APP_ID_1', 'API_KEY_1')
$index2 = \Algolia\AlgoliaSearch\SearchClient::create('APP_ID_2', 'API_KEY_2')

\Algolia\AlgoliaSearch\AccountClient::copyIndex($index1, $index2);

If you want to move an index between Algolia applications, you can copy it first, and then delete it.

Copy index settings

If you want to copy only an index’s setting to another index, you can use the Manage index > Copy Settings action in the dashboard, or the copySettings method of the API clients.

Did you find this page helpful?