I am adding 1000 documents to the IndexBatch and calling index() method some thing like below
var batch = IndexBatch.New(actions);
indexClient.Documents.Index(batch);
I kept this code in a loop where I need to upload around 50 Million documents to Azure Search. After it is executing around somewhere 15 to 20 times (15k to 20k documents) in the loop, it is failing and throwing exception which says below
"The request is invalid. Details: actions: No indexing actions found in the request. Please include between 1 and 32000 indexing actions in your request."
Why I am getting this exception randomly.
Can you suggest the better approach to handle below scenarios
- How to make sure previous batch of documents got indexed before attempting to load another batch (Since I am running these statements at least 50K times in a loop)
- any errors caused because of the load of service.