# Correct settings for "es.nodes.wan.only"

**URL:** <https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [August 23, 2016, 8:56pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743 "2016-08-23T20:56:52Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![darthapple](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@darthapple](https://discuss.elastic.co/u/darthapple)\
**Post date:** [August 23, 2016, 8:56pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/1 "2016-08-23T20:56:53Z")

</div>

Hello,

I am trying to run a spark job to load data from emr to ES cluster hosted by [elastic.co](http://elastic.co). [cluster ID "665e60"]

Following is code snippet i am using to test this.

> ```
> import java.io.PrintStream
> import org.apache.spark.SparkContext    
> import org.apache.spark.SparkContext._
> 
> ```

> ```
> import org.elasticsearch.spark._ 
> 
> ```

> ```
> val conf = new SparkConf()
> conf.set("spark.es.nodes","ssssss.us-east-1.aws.found.io")
> conf.set("spark.es.port","9243")
> conf.set("spark.es.nodes.discovery","ture")
> conf.set("spark.es.nodes.client.only","false")
> conf.set("spark.es.nodes.wan.only","false")`indent preformatted text by 4 spaces`
> conf.set("spark.es.net.http.auth.user","sssss")
> conf.set("spark.es.net.http.auth.pass","lololol")
> val sc = new SparkContext(conf)    
> // print(conf.toDebugString)
> val numbers = Map("one" -> 1, "two" -> 2, "three" -> 3)
> val airports = Map("arrival" -> "Otopeni", "SFO" -> "San Fran")
> 
> ```

> ```
> sc.makeRDD(Seq(numbers, airports)).saveToEs("spark/docs")
> 
> ```

Which results in the following error.  
\> 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'  
\> at org.elasticsearch.hadoop.rest.InitializationUtils.discoverEsVersion(InitializationUtils.java:196)  
\> at org.elasticsearch.hadoop.rest.RestService.createWriter(RestService.java:379)  
\> at org.elasticsearch.spark.rdd.EsRDDWriter.write(EsRDDWriter.scala:40)  
\> at org.elasticsearch.spark.rdd.EsSpark$$anonfun$doSaveToEs$1.apply(EsSpark.scala:84)  
\> at org.elasticsearch.spark.rdd.EsSpark$$anonfun$doSaveToEs$1.apply(EsSpark.scala:84)  
\> at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)  
\> at org.apache.spark.scheduler.Task.run(Task.scala:89)  
\> at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:227)  
\> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
\> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
\> at java.lang.Thread.run(Thread.java:745)

Can someone please suggest what config am i missing here ?

* * *

* * *

---

<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 24, 2016, 3:51pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/2 "2016-08-24T15:51:31Z")

</div>

Your Spark driver is able to connect to the ES Cloud instance, but it seems that the Executors do not have the capability to establish a connection. This is normally the case when running in cloud environments, as most cloud environments keep all of their executors/task runners inside of a separate secured network. You will need to make sure that the executors/task runners are able to connect to the provided ES node by configuring the network settings of your deployment.

---

<div class="post-metadata">

**Author:** ![darthapple](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@darthapple](https://discuss.elastic.co/u/darthapple)\
**Post date:** [October 12, 2016, 10:41pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/3 "2016-10-12T22:41:13Z")

</div>

Thanks James,  
I was able figure this out.

---

<div class="post-metadata">

**Author:** ![animageofmine](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@animageofmine](https://discuss.elastic.co/u/animageofmine)\
**Post date:** [January 31, 2017, 4:29am UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/4 "2017-01-31T04:29:19Z")

</div>

@darthapple Can you share what was the issue and how did you fix?

---

<div class="post-metadata">

**Author:** ![bobby259](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bobby259](https://discuss.elastic.co/u/bobby259)\
**Post date:** [May 10, 2017, 5:32pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/5 "2017-05-10T17:32:21Z")

</div>

@darthapple what was the resolution for this?  
@animageofmine were you able to resolve this? I am facing the same issue. Please help.

---

<div class="post-metadata">

**Author:** ![jobyjohny](https://avatars.discourse-cdn.com/v4/letter/j/eada6e/32.png) [@jobyjohny](https://discuss.elastic.co/u/jobyjohny)\
**Post date:** [June 29, 2017, 8:56pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/6 "2017-06-29T20:56:41Z")

</div>

I am facing issue now. Could you please let me know the fix details

---

<div class="post-metadata">

**Author:** ![Mayank\_Vijay](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Mayank\_Vijay](https://discuss.elastic.co/u/Mayank_Vijay)\
**Post date:** [July 6, 2017, 7:39am UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/8 "2017-07-06T07:39:06Z")

</div>

Hello,  
I just want to view data stored in elastic search in form of hive table. The hive query i run is:  
CREATE EXTERNAL TABLE testHiveELKTable (account int, quantity int) STORED BY 'org.elasticsearch.hasoop.hive.EsStoragwHandler' TBLPROPERTIES('es.resource' = 'index/type');

But i get,  
Failed:Execution Error, return code 1 fromorg.apache.hadoop.hive.ql.exec.DDLTask. org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: Cannot detect ES version- this typically happens if network/elasticsearch cluster is not accessible or when targetting a WAN/Cloud instance without proper setting in 'es.nodes.wan.only'

I even tried setting es.nodes.wan.only = true but still error shows.

---

<div class="post-metadata">

**Author:** ![donghe90](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@donghe90](https://discuss.elastic.co/u/donghe90)\
**Post date:** [November 16, 2017, 10:35pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/9 "2017-11-16T22:35:51Z")

</div>

This issue was a headache for me as well. I bypass this by adding executors' ipaddress to AWS elasticsearch access policy. Hope this help.

---

<div class="post-metadata">

**Author:** ![Mohammed\_sheik](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Mohammed\_sheik](https://discuss.elastic.co/u/Mohammed_sheik)\
**Post date:** [October 24, 2018, 12:14pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/10 "2018-10-24T12:14:26Z")

</div>

> [@Mayank\_Vijay](#):
>
> an.only = true but still error shows.

James

we are running locally the spark as standalone master so when spark driver able to connect what could be other reasons?

---

<div class="post-metadata">

**Author:** ![nara](https://avatars.discourse-cdn.com/v4/letter/n/e5b9ba/32.png) [@nara](https://discuss.elastic.co/u/nara)\
**Post date:** [January 9, 2019, 5:05pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/11 "2019-01-09T17:05:56Z")

</div>

Hi @darthapple,

Could you please post the solution. As , I am experiencing the same issue. I have hosted both EMR and ES on AWS. Thanks!

---

<div class="post-metadata">

**Author:** ![Dima\_Dermanskyi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dima_dermanskyi/32/54496_2.png) [@Dima\_Dermanskyi](https://discuss.elastic.co/u/Dima_Dermanskyi)\
**Post date:** [September 19, 2019, 10:03am UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/12 "2019-09-19T10:03:45Z")

</div>

For me even when I had `es.nodes.wan.only = true` it still complained that it `org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: Cannot detect ES version`

I use ES provided by AWS Elasticsearch service. In order to overcome the problem I also had to add the following config property: `es.net.ssl = true`.

---

<div class="post-metadata">

**Author:** ![Phan\_Trung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phan_trung/32/54579_2.png) [@Phan\_Trung](https://discuss.elastic.co/u/Phan_Trung)\
**Post date:** [September 25, 2019, 3:55am UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/13 "2019-09-25T03:55:27Z")

</div>

just import right version with your elasticsearch cluster version, it will work well all the time.

---

<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:29pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/14 "2019-10-16T20:29:03Z")

</div>

Not being able to connect to Elasticsearch is a common problem and we appreciate when people post solutions that got them out of that problem. That said, I am going to close this thread since it is quite old and is often resurrected while a new thread may have been better to post questions and solutions in. Thank you all for your participation!

---

<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:29pm UTC](https://discuss.elastic.co/t/correct-settings-for-es-nodes-wan-only/58743/15 "2019-10-16T20:29:07Z")

</div>


