Required ACL: addObject, deleteIndex (optional, for cleanup after a failed operation)
This helper method replaces all records in an index without interrupting ongoing searches.
It combines batch and copy/move index operations:
Copy settings, synonyms, and rules to a temporary index.
Add the records from the objects parameter to the temporary index.
Replace the original index with the temporary one.
Notes:
If your API key restricts access to specific indices, make sure it also grants access to the temporary index INDEX_NAME_tmp_*. Replace INDEX_NAME with the name of your original index.
This method creates a temporary index, so your record count can temporarily double during the operation.
Algolia doesn’t count the three days with the highest number of records towards usage.
This method is subject to indexing rate limits .
If the operation fails, the original index isn’t replaced.
The client can delete the temporary index only if your API key has the deleteIndex ACL.
The response includes the results of the individual API requests.
Usage
Parameters
C#
Go
Java
JavaScript
Kotlin
PHP
Python
Ruby
Scala
Swift
Name of the index in which to replace records.
Records that replace the existing records in your index.
The model of your index’s records.
Number of records to process in one batch.
Scopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . cancellationToken CancellationToken
default: "default"
Parameter that can be used as a signal to cancel this request.
Name of the index in which to replace records.
Records that replace the existing records in your index.
Functional options to provide extra arguments. Signature: func(scopes []ScopeType) replaceAllObjectsOptionScopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . Signature: func(batchSize int) chunkedBatchOptionNumber of records to process in one batch.
The default batch size is 1,000.
Signature: func(withWaitForTasks bool) chunkedBatchOptionWhether to wait until all batch requests are done.
Signature: func(key string, value string) requestOptionSets extra header parameters for this request.
To learn more, see request options . Signature: func(key string, value string) requestOptionSets extra query parameters for this request.
To learn more, see request options . Name of the index in which to replace records.
Records that replace the existing records in your index.
The model of your index’s records.
Number of records to process in one batch.
Scopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . Name of the index in which to replace records.
objects Record<string,unknown>[]
required
Records that replace the existing records in your index.
Number of records to process in one batch.
Scopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . Name of the index in which to replace records.
Records that replace the existing records in your index.
Number of records to process in one batch.
Scopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . Name of the index in which to replace records.
Records that replace the existing records in your index.
Number of records to process in one batch.
Scopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . Name of the index in which to replace records.
Records that replace the existing records in your index.
Number of records to process in one batch.
Scopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . Name of the index in which to replace records.
Records that replace the existing records in your index.
Number of records to process in one batch.
Scopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . Name of the index in which to replace records.
Records that replace the existing records in your index.
Number of records to process in one batch.
Scopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . Name of the index in which to replace records.
Records that replace the existing records in your index.
Number of records to process in one batch.
Scopes to include in the replacement operation.
Use one or more ScopeType values.
For the allowed values, see Scope types . Last modified on April 10, 2026