Wait for operations
Required API Key:
any key with the
addObject
ACL
$index->saveObject(...)->wait(); $index->saveObjects(...)->wait(); $index->partialUpdateObject(...)->wait(); $index->partialUpdateObjects(...)->wait(); $index->replaceAllObjects(...)->wait(); $index->deleteObject(...)->wait(); $index->deleteObjects(...)->wait(); $index->deleteBy(...)->wait(); $index->clearObjects(...)->wait(); $index->batch(...)->wait(); $index->setSettings(...)->wait(); $index->saveSynonym(...)->wait(); $index->saveSynonyms(...)->wait(); $index->replaceAllSynonyms(...)->wait(); $index->deleteSynonym(...)->wait(); $index->clearSynonyms(...)->wait(); $index->saveRule(...)->wait(); $index->saveRules(...)->wait(); $index->replaceAllRules(...)->wait(); $index->deleteRule(...)->wait(); $index->clearRules(...)->wait(); $client->moveIndex(...)->wait(); $client->copyIndex(...)->wait(); $client->copyRules(...)->wait(); $client->copySynonyms(...)->wait(); $client->copySettings(...)->wait(); $client->addApiKey(...)->wait(); $client->updateApiKey(...)->wait(); $client->deleteApiKey(...)->wait(); $client->multipleBatch(...)->wait();
You’re currently reading the JavaScript API client v4 documentation. Check the migration guide to learn how to upgrade from v3 to v4. You can still access the v3 documentation.
You’re currently reading the Ruby API client v2 documentation. Check the migration guide to learn how to upgrade from v1 to v2. You can still access the v1 documentation.
About this method
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 task’s taskID
and the waitTask
method.
Examples
Read the Algolia CLI documentation for more information.
Wait until a new object is added to an index
1
2
3
4
5
6
$index->addObject(
[
'firstname' => 'Jimmie',
'lastname' => 'Barninger'
]
)->wait();
If you want to ensure multiple objects have been indexed, you must check all taskID
s.
Wait for indexing of a new object and send extra http header
1
2
3
4
5
6
7
8
$index->addObject(
[
'firstname' => 'Jimmie',
'lastname' => 'Barninger'
]
)->wait([
'X-Forwarded-For' => '94.228.178.246'
]);
Parameters
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
This method doesn't return a response.