Skip to main content
Required ACL: addObject Before using this method, you must create a push connector. 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.
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 and connector limits. The response includes the results of the individual API requests.

Usage

response, err := client.ReplaceAllObjectsWithTransformation(
  "ALGOLIA_INDEX_NAME",
  []map[string]any{map[string]any{"objectID": "1", "name": "Adam"}, map[string]any{"objectID": "2", "name": "Benoit"}, map[string]any{"objectID": "3", "name": "Cyril"}, map[string]any{"objectID": "4", "name": "David"}, map[string]any{"objectID": "5", "name": "Eva"}, map[string]any{"objectID": "6", "name": "Fiona"}, map[string]any{"objectID": "7", "name": "Gael"}, map[string]any{"objectID": "8", "name": "Hugo"}, map[string]any{"objectID": "9", "name": "Igor"}, map[string]any{"objectID": "10", "name": "Julia"}}, search.WithBatchSize(3))
if err != nil {
  // handle the eventual error
  panic(err)
}

Parameters

  • Go
  • Java
  • JavaScript
  • PHP
  • Python
indexName
string
required
Name of the index in which to replace records.
objects
[]map[string]any
required
Records that replace the existing records in your index.
opts...
replaceAllObjectsOption
Functional options to provide extra arguments.
I