Write operations in Algolia are asynchronous by design, so the indexing may take a few seconds (a few minutes if you index a lot of records at the same time).
It means that when you add or update an object to your index, our servers will reply to your request as soon as they understood the write operation but the actual indexing will start a few seconds later, asynchronously.
If you want to know when a particular write operation is completed, you can use the
task endpoint along with the
taskID
you got from our servers when inserting or updating data.
Here’s an example using our
JavaScript API client:
index.addObject({ 'firstname': 'Jimmie', 'lastname': 'Barninger' }, function gotTaskID(error, content) { console.log("write operation received: " + content.taskID); index.waitTask(content.taskID, function contentIndexed() { console.log("object " + content.objectID + " indexed"); }); });<br>
0 Comments