0

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;
Puzzle
  • 23
  • 1
  • 4

1 Answers1

1

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.

Eugene Shvets
  • 4,561
  • 13
  • 19
  • I actually query the indexer status and it is showing success. I think it's that delay that is the "issue" here. Any way to know when it's going to show up in the search? – Puzzle Jan 22 '18 at 05:59
  • As I mentioned, the delay is usually very short, but the only way to tell deterministically is by actually issuing a search and retrying a few times if needed. I assume this is needed in a testing scenario? – Eugene Shvets Jan 22 '18 at 06:52
  • What do you mean by testing scenario? Our program works in the following way: We have data stored in blobs, we use the indexer to populate our index with the data in those blobs. When we update the blobs, we run the indexer so the updated data also get's updated in the index. – Puzzle Jan 22 '18 at 18:05