Skip to main content
Required ACL: addObject This 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.
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 is subject to indexing rate limits. The response includes the results of the individual API requests.

Usage

var response = await client.ReplaceAllObjectsAsync(
  "ALGOLIA_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

  • C#
  • Go
  • Java
  • JavaScript
  • Kotlin
  • PHP
  • Python
  • Ruby
  • Scala
  • Swift
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. Can be one or more of settings, synonyms, or rules. For more details, see Scope types.
requestOptions
RequestOptions
Additional request options.
cancellationToken
CancellationToken
default:"default"
Parameter that can be used as a signal to cancel this request.
I