Solving error 413 when using BulkAllObserver (NEST)

I'm using the C# NEST-api to index documents to elastic, with BulkAllObserver as described here: Indexing documents | Elasticsearch .NET Clients [7.17] | Elastic

My documents are generally a few kB, but can sometimes be very large (a few MB). With the result that we occasionally get a response HTTP 413 (Payload too large). Of course, I could fix this by decreasing the bulk-size, but this seems like a waste when I also have lots of smaller documents.

Another solution might be to just send the documents, and wait for the return: if we get a 200, that's fine, but if we get a 413, we cut our stack of documents in two, and resend our data in 2 portions.
Would such a thing be possible, using the high-level NEST-client?

Using the Elasticsearch.Net package version 7.16.0, on Windows, communicating with ES 7.16.2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.