elasticsearch-net icon indicating copy to clipboard operation
elasticsearch-net copied to clipboard

BulkAll doesn't retry 429s when ThrowExceptions is enabled

Open nobowned opened this issue 2 years ago • 2 comments

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:

  1. Turn on ThrowExceptions.
  2. Call BulkAll with BackOffRetries set to something greater than 0.
  3. Call Wait on the BulkAllObservable returned by BulkAll.
  4. 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.

nobowned avatar May 09 '22 23:05 nobowned

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.

nobowned avatar May 11 '22 18:05 nobowned

Thanks for raising this @nobowned. I'll need to spend some time on this to reproduce and determine the best option for this.

stevejgordon avatar May 20 '22 16:05 stevejgordon