# How to save spark scala dataframe to elastic search

**URL:** <https://discuss.elastic.co/t/how-to-save-spark-scala-dataframe-to-elastic-search/142315>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [July 31, 2018, 8:57am UTC](https://discuss.elastic.co/t/how-to-save-spark-scala-dataframe-to-elastic-search/142315 "2018-07-31T08:57:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheryl](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@sheryl](https://discuss.elastic.co/u/sheryl)\
**Post date:** [July 31, 2018, 8:57am UTC](https://discuss.elastic.co/t/how-to-save-spark-scala-dataframe-to-elastic-search/142315/1 "2018-07-31T08:57:44Z")

</div>

i am using this df to save into elasticsearch but it showing error  
--- ERROR NetworkClient: Node [192.168.0.1:9200] failed (Connection timed out: connect); no other nodes left - aborting... --

df.write.format("org.elasticsearch.spark.sql").option("es.nodes.wan.only","true")  
.option("es.port","9200")  
.option("es.net.ssl","true")  
.option("es.nodes","192.168.0.1")  
.mode("append")  
.option("es.nodes.client.only", "false")  
.save("C:\elasticsearch-6.3.1")

i m running this on windows but not working .

---

<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:** [August 14, 2018, 3:45am UTC](https://discuss.elastic.co/t/how-to-save-spark-scala-dataframe-to-elastic-search/142315/2 "2018-08-14T03:45:57Z")

</div>

Please avoid double posting on here as it creates clutter and makes it harder for people to respond or find answers. I will respond on your other topic.

> [@Not able to detect ES version](https://discuss.elastic.co/t/not-able-to-detect-es-version/142340):
>
> Exception in thread "main" org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: Cannot detect ES version - typically this happens if the network/Elasticsearch cluster is not accessible or when targeting a WAN/Cloud instance without the proper setting 'es.nodes.wan.only' i am dumping dataframe to elastic search but i am not able to do it . df.write.format("org.elasticsearch.spark.sql") .option("es.nodes.wan.only","true") .option("es.port","9200") .option("es.net.ssl","true") .option("…

---

<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:** [August 14, 2018, 3:46am UTC](https://discuss.elastic.co/t/how-to-save-spark-scala-dataframe-to-elastic-search/142315/3 "2018-08-14T03:46:11Z")

</div>


