Skip to main content
This helper method copies an index from one Algolia application to another, by performing these tasks:
  1. Copy settings from the source index to the destination index.
  2. Iterate through the paginated responses to retrieve all records, rules, and synonyms from the source index.
  3. Copy the records, rules, and synonyms to the destination index.
For the source application, you need an API key with browse and settings ACL. For the destination application, you need an API key with addObject, settings, and editSettings ACL.

Usage

const response = await client.accountCopyIndex({
  sourceIndexName: 'cts_e2e_account_copy_index_source_javascript',
  destinationAppID: 'test-app-id-destination',
  destinationApiKey: 'test-api-key-destination',
  destinationIndexName: 'cts_e2e_account_copy_index_destination_javascript',
  batchSize: 2,
});

Parameters

sourceIndexName
string
required
Name of the index from where to copy records, rules, settings, and synonyms.
destinationAppID
string
required
Algolia application ID of the destination index.
destinationApiKey
string
required
API key for the destination application.
destinationIndexName
string
required
Name of the index to which to copy records, rules, settings, and synonyms.
batchSize
int
default:1000
Number of records to process in one batch.
I