# EsHadoopNoNodesLeftException-all nodes failed On Spark.SaveToES

**URL:** <https://discuss.elastic.co/t/eshadoopnonodesleftexception-all-nodes-failed-on-spark-savetoes/202161>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [October 3, 2019, 12:18pm UTC](https://discuss.elastic.co/t/eshadoopnonodesleftexception-all-nodes-failed-on-spark-savetoes/202161 "2019-10-03T12:18:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramakrishnan\_Venkata](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramakrishnan_venkata/32/48249_2.png) [@Ramakrishnan\_Venkata](https://discuss.elastic.co/u/Ramakrishnan_Venkata)\
**Post date:** [October 3, 2019, 12:18pm UTC](https://discuss.elastic.co/t/eshadoopnonodesleftexception-all-nodes-failed-on-spark-savetoes/202161/1 "2019-10-03T12:18:15Z")

</div>

Hi,

I Get "EsHadoopNoNodesLeftException: Connection error (check network and/or proxy settings)- all nodes failed" When i do a df = spark.sql(select \* from a table)and do a df.saveToES(indexName+"/docs")

I have 200 ORC files and with average of 145mb (raw data) = ~29GB of serialized and compressed ORC raw data.

I see 200 tasks in SPARK UI during the above code.

And the last task gets failed with the above exception.

I infer from this ticket: [Similar Issue](https://discuss.elastic.co/t/elasticsearch-spark-eshadoopnonodesleftexception-in-cluster-mode/21367)

That i need to reduce the bulk SIZE.

MY QUESTION:

How to determine the bulk size during dataframe.saveToEs() during runtime? Is there a formula based on No of executors, Cores, Memory etc..?

How to reduce the bulk size?

Thanks

---

<div class="post-metadata">

**Author:** ![james.baiera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james.baiera/32/10209_2.png) [@james.baiera](https://discuss.elastic.co/u/james.baiera)\
**Post date:** [October 16, 2019, 8:19pm UTC](https://discuss.elastic.co/t/eshadoopnonodesleftexception-all-nodes-failed-on-spark-savetoes/202161/2 "2019-10-16T20:19:45Z")

</div>

You can configure the bulk size using the properties detailed at [https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html#configuration-serialization](https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html#configuration-serialization), but it's also important to fully understand why the tasks are failing. I'd suggest looking through the task log for error messages for why node connections might be failing.

---

<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:** [November 13, 2019, 8:26pm UTC](https://discuss.elastic.co/t/eshadoopnonodesleftexception-all-nodes-failed-on-spark-savetoes/202161/3 "2019-11-13T20:26:38Z")

</div>

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