Reputation: 23
I have an application where the client side update a blob. After the blob is updated, I run the Indexer so that it updates the index. After I do a search on the updated index to retrieve the updated event to show it in the frontend.
The problem is that it still shows the old data. Even though the RunAsync() is completed, in otherwords meaning that the index is updated, the searchAsync still returns the old data.
If I put Delay between the update and search I then get the updated document.
Any reason why this is happening??
EDIT:
To verify if the job is completed I use the following:
IndexerExecutionStatus s = _searchServiceClient.Indexers.GetStatusAsync(indexerName).Result.LastResult.Status;
Upvotes: 0
Views: 206
Reputation: 4671
This behavior is expected. Running an indexer only schedules an indexer run, which starts later and could take seconds, minutes or even hours to run depending on the number of blobs in the container and how many have changed.
You need to query the indexer status to find out when the indexer run has actually completed successfully.
Moreover, even if you add documents to an index directly, there will be a delay before the updates show up in searches. Usually, this delay is small (less than a second), but it can be longer if the service is busy handling a lot of requests.
Upvotes: 1