API Reference / API Methods / Manage indices / Copy index
Required API Key: any key with the addObject ACL
Method signature
  string indexNameSrc,
  string indexNameDest
  string indexNameSrc,
  string indexNameDest,
    'scope' => array

// Copy index in between apps
  SearchIndex indexSrc,
  SearchIndex indexDest

About this method

We released a new version of the PHP API client in public beta. Read the beta documentation for more information.

We released a new version of the JavaScript API client in public beta. Read the beta documentation for more information.

We released a new version of the Java API client in public beta. Read the beta documentation for more information.

You’re currently reading the JavaScript API client v4 documentation. Check the migration guide to learn how to upgrade from v3 to v4. You can still access the v3 documentation.

You’re currently reading the Ruby API client v2 documentation. Check the migration guide to learn how to upgrade from v1 to v2. You can still access the v1 documentation.

Make a copy of an index, including its records, settings, Synonyms, and Rules except for the enableReRanking setting.

With this method you can copy the entire index (records, settings, Synonyms, and Rules) or any subset of the following:

  • settings,
  • Synonyms,
  • and Rules.

Use the scope parameter to determine what you want to copy.

Copy operations overwrite destination indices. This means that everything besides the API keys and the Analytics data is lost.

Copying is an expensive operation:

  • When you have more than 100 pending requests, they’re automatically throttled.
  • When you have more than 5000 pending requests, further requests are ignored.

If needed, you can configure these limits.

During a copy operation, if your source index doesn’t exist, the operation is ignored. You can still perform a waitTask for this job.

API keys

The API keys of the source are merged with the existing keys in the destination index.


Copying an index has no impact on Analytics, because you cannot copy an index’s analytics data.


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

You can’t copy to a destination index that already has replicas.


Using the scope parameter, you can copy specific parts of your source index .

If you omit the scope parameter, then everything is copied. If you use it, you’re copying specific scopes rather than records.

For example, if you specify "settings" and "synonyms", you’re copying your source index’s settings and Synonyms, but ignoring its Rules and records. On the other hand, if you don’t specify a scope (that is, you omit the scope parameter) then the copy command works as by default: copying all records, settings, Synonyms, and Rules.

Copied items fully replace the corresponding scopes in the destination index. The engine doesn’t do any kind of merging of items that belong to the same scope, it fully overwrites them.

Whenever you use the scope parameter, the engine preserves items belonging to scopes that weren’t copied. For example, if you’re copying to an index that already has records, and you specify "settings" and "synonyms" as the scope, the engine will preserve the existing records in the destination index.


Copy an index

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

Copy resources between indices

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

Copy index between apps

$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);


type: string

Name of the source index to copy.

type: string

Name of the destination index.

type: object

Source index object.

type: object

Destination index object.

type: list

An array containing any combination of the following strings:

  • settings
  • synonyms
  • rules

See more on how this parameter works.


This section shows the JSON response returned by the API. Since each language encapsulates this response inside objects specific to that language and/or implementation, the actual type in your language might differ from what’s written here. You can view the response in the logs (using the getLogs method).

JSON format

  "updatedAt": "2017-12-18T21:22:40.761Z",
  "taskID": 19541511530
date string

Date at which the job to copy the index has been created.


This is the taskID which is used with the waitTask method.

Note: You can use either the source or destination index to wait on the resulting taskID. In either case, the wait will include the full copy process.

Did you find this page helpful?