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
objectsparameter to the temporary index. - Replace the original index with the temporary one.
-
If your API key restricts access to specific indices, make sure it also grants access to the temporary index
INDEX_NAME_tmp_*. ReplaceINDEX_NAMEwith 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
deleteIndexACL.
Usage
Parameters
- C#
- Go
- Java
- JavaScript
- Kotlin
- PHP
- Python
- Ruby
- Scala
- Swift
string
required
Name of the index in which to replace records.
IEnumerable<T>
required
Records that replace the existing records in your index.
type parameter
required
The model of your index’s records.
int
default:1000
Number of records to process in one batch.
List<ScopeType>
required
Scopes to include in the replacement operation.
Use one or more
ScopeType values.
For the allowed values, see Scope types.RequestOptions
Additional request options.
CancellationToken
default:"default"
Parameter that can be used as a signal to cancel this request.