elasticsearch-net
elasticsearch-net copied to clipboard
BulkAll doesn't retry 429s when ThrowExceptions is enabled
NEST/Elasticsearch.Net version: 7.10.0
Elasticsearch version: 7.10.0
.NET runtime version: .net 6.0
Operating system version: Windows 10.0.19044 Build 19044
Description of the problem including expected versus actual behavior: BulkAll won't retry 429s if ThrowExceptions is enabled.
Steps to reproduce:
- Turn on ThrowExceptions.
- Call BulkAll with BackOffRetries set to something greater than 0.
- Call Wait on the BulkAllObservable returned by BulkAll.
- Ensure a 429 will occur. This can be done by bulk indexing more documents than your cluster can handle.
Expected behavior 429s are retried with ThrowExceptions enabled.
A quick fix could be to disable ThrowExceptions on the BulkAsync call performed by BulkAllObservable:
https://github.com/nobowned/elasticsearch-net/blob/f6bbf21e81c22d9fe160725f87e16ab2ed0cdbdb/src/Elastic.Clients.Elasticsearch/Helpers/BulkAllObservable.cs#L120-L124
I think this should be fine since BulkAllObservable will throw it's own exceptions if something goes wrong anyways.. regardless of the "ThrowExceptions" setting.
Thanks for raising this @nobowned. I'll need to spend some time on this to reproduce and determine the best option for this.