Skip to main content
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:
  1. Copy settings, synonyms, and rules to a temporary index.
  2. Add the records from the objects parameter to the temporary index.
  3. 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

var response = await client.ReplaceAllObjectsAsync(
  "INDEX_NAME",
  new List<Object>
  {
    new Dictionary<string, string> { { "objectID", "1" }, { "name", "Adam" } },
    new Dictionary<string, string> { { "objectID", "2" }, { "name", "Benoit" } },
  },
  77,
  new List<ScopeType> { Enum.Parse<ScopeType>("Settings"), Enum.Parse<ScopeType>("Synonyms") }
);

Parameters

indexName
string
required
Name of the index in which to replace records.
objects
IEnumerable<T>
required
Records that replace the existing records in your index.
T
type parameter
required
The model of your index’s records.
batchSize
int
default:1000
Number of records to process in one batch.
scopes
List<ScopeType>
required
Scopes to include in the replacement operation. Use one or more ScopeType values. For the allowed values, see Scope types.
requestOptions
RequestOptions
Additional request options.
cancellationToken
CancellationToken
default:"default"
Parameter that can be used as a signal to cancel this request.
Last modified on April 13, 2026