Document update is returning 200 OK before the index was actually updated

Category: azure search


George Cantor on Wed, 28 Sep 2016 18:56:11


If we take a look at the Azure Search documentation concerning the documents update, we can find "Status code: "200 OK' is returned for a successful response, meaning that all items have been successfully indexed". My problem is the following : when I update a document (with mergeOrUpload action) and fetch it immediately after receiving the 200 OK response, I receive the old version of this document. On the other hand, if I update a document and sleep for 1 second before fetching it, the result of this fetch will be the updated document.

To me, this non-deterministic result feels like the 200 OK response from the POST request is actually returned before the document has been successfully indexed. Am I missing something?

Thank you for your time!


Pablo M. Castro on Wed, 28 Sep 2016 19:46:52

The statement in the documentation is inaccurate, apologies for the confusion, we'll get it corrected. Updates in Azure Search are eventually consistent.

Status code 200 on an indexing request indicates that your change has been successfully stored durably. It doesn't mean it has been indexed. Indexing happens in the background, with most cases in lightly loaded services happening after a few seconds, though highly loaded clusters can see higher index-to-search latency.

So the behavior you're seeing is expected.

George Cantor on Wed, 28 Sep 2016 19:59:02

Perfect, thank you