Aakanksha Sethi
Aakanksha Sethi

Reputation: 11

Azure Search : Delay in data reflecting in Search Index

I have an API which is adding multiple rows of data to our Search Index using the following code :

var documentList = new List<IndexBase> { document };

var batch = IndexBatch.Upload(documentList);           

await searchIndexClient.Documents.IndexAsync(batch);

The API (after insertion of data) checks the count of documents originally passed in the API call and the count of the documents present in Search Index. However, the count is not always the same.

On adding some delay to the API after insertion to Search and then querying the Search Index again gives the correct count. There seems to be a lag in inserting data to the Search Index.

Is that the expected behavior ?

I am using the Microsoft.Azure.Search.3.0.4 DLL.

Upvotes: 1

Views: 953

Answers (1)

Nati Nimni
Nati Nimni

Reputation: 258

Indeed that is an expected behavior – documents indexed to a service will be visible for querying after a short delay, like you observed. While the delay depends on the service topology and indexing load, Azure search do guarantee that successfully indexed documents will eventually be visible for search requests.

For more details, please read the "Response" section of Add, Update or Delete Documents (Azure Search Service REST API) document.

I hope this helps.

Upvotes: 4

Related Questions