# Solving error 413 when using BulkAllObserver (NEST)

**URL:** <https://discuss.elastic.co/t/solving-error-413-when-using-bulkallobserver-nest/324356>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [January 31, 2023, 4:03pm UTC](https://discuss.elastic.co/t/solving-error-413-when-using-bulkallobserver-nest/324356 "2023-01-31T16:03:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emil/32/49885_2.png) [@Emil](https://discuss.elastic.co/u/Emil)\
**Post date:** [January 31, 2023, 4:03pm UTC](https://discuss.elastic.co/t/solving-error-413-when-using-bulkallobserver-nest/324356/1 "2023-01-31T16:03:51Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/client/net-api/7.17/indexing-documents.html)

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](http://Elasticsearch.Net) package version 7.16.0, on Windows, communicating with ES 7.16.2

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 28, 2023, 4:04pm UTC](https://discuss.elastic.co/t/solving-error-413-when-using-bulkallobserver-nest/324356/2 "2023-02-28T16:04:20Z")

</div>

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