API client / Methods / Advanced
Required API Key: any key with the addObject ACL
Method signature
index.save_object(...).wait()
index.save_objects(...).wait()
index.partial_update_object(...).wait()
index.partial_update_objects(...).wait()
index.replace_all_objects(...).wait()
index.delete_object(...).wait()
index.delete_objects(...).wait()
index.delete_by(...).wait()
index.clear_objects(...).wait()
index.batch(...).wait()

index.set_settings(...).wait()

index.save_synonym(...).wait()
index.save_synonyms(...).wait()
index.replace_all_synonyms(...).wait()
index.delete_synonym(...).wait()
index.clear_synonyms(...).wait()

index.save_rule(...).wait()
index.save_rules(...).wait()
index.replace_all_rules(...).wait()
index.delete_rule(...).wait()
index.clear_rules(...).wait()


client.move_index(...).wait()
client.copy_index(...).wait()
client.copy_rules(...).wait()
client.copy_synonyms(...).wait()
client.copy_settings(...).wait()

client.add_api_key(...).wait()
client.update_api_key(...).wait()
client.delete_api_key(...).wait()
client.multiple_batch(...).wait()

About this method # A

Wait for a task to complete to ensure synchronized index updates.

All Algolia write operations are asynchronous. When you make a request for a write operation, for example, to add or update records in your index, Algolia creates a task on a queue and returns a taskID. The task itself runs separately, depending on the server load. You can wait for a write operation to complete by using the tasks’s taskID' and the waitTask` method.

Examples # A

Wait until a new object is added to an index#

1
2
3
4
index.save_object({
      'firstname': 'Jimmie',
      'lastname': 'Barninger'
  }, {'autoGenerateObjectIDIfNotExist': True}).wait()

If you want to ensure multiple objects have been indexed, you must check all taskIDs.

Wait for indexing of a new object and send extra http header#

1
2
3
4
5
6
index.save_object({
    'firstname': 'Jimmie',
    'lastname': 'Barninger'
}, {'autoGenerateObjectIDIfNotExist': True}).wait({
    'X-Forwarded-For': '94.228.178.246'
})

Parameters # A

Parameter Description
taskID #
type: string
Required

taskID of the indexing task to wait for.

requestOptions #
type: list
default: No requestOptions
Optional

A list of request options to send along with the query.

Response # A

This method doesn't return a response.

Did you find this page helpful?
Python v3