Write operations in Algolia are asynchronous by design. When you’re indexing records, it may take a few seconds (or minutes if you’re indexing many records at the same time) to complete.
When you add or update a record, our servers reply to your request as soon as they understand the operation, but the actual indexing starts a few seconds later, asynchronously.
If you want to know when a particular write operation is complete, you can wait for the operation using one of the API clients. Please note that, depending on your use case, this can slow down the execution of your indexing script. Make sure you only wait for tasks when necessary.