batch method

AlgoliaBatch batch()

AlgoliaBatch

Creates a write batch, used for performing multiple writes as a single atomic operation.

Perform multiple write operations in a single API call.

In order to reduce the amount of time spent on network round trips, you can perform multiple write operations at once. All operations will be applied in the order they are specified.

Operations you can batch The following actions are supported:

  • addObject: Add an object. Equivalent to Add an object without ID.
  • updateObject: Add or replace an existing object. You must set the objectID attribute to indicate the object to update. Equivalent to Add/update an object by ID.
  • partialUpdateObject: Partially update an object. You must set the objectID attribute to indicate the object to update. Equivalent to Partially update an object.
  • partialUpdateObjectNoCreate: Same as partialUpdateObject, except that the object is not created if the object designed by objectID does not exist.
  • deleteObject: Delete an object. You must set the objectID attribute to indicate the object to delete. Equivalent to Delete an object.
  • delete: Delete the index. Equivalent to Delete an index.
  • clear: Remove the index’s content, but keep settings and index- specific API keys untouched. Equivalent to Clear objects.

Implementation

AlgoliaBatch batch() => AlgoliaBatch._(algolia, index);