02 Jul 2018

Why are my objects not immediately available for search after adding them?

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 method.

Here’s an example using our JavaScript API client:

  '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");