# EsHadoopIllegalArgumentException: Cannot detect ES version

**URL:** <https://discuss.elastic.co/t/eshadoopillegalargumentexception-cannot-detect-es-version/342593>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [September 8, 2023, 9:33am UTC](https://discuss.elastic.co/t/eshadoopillegalargumentexception-cannot-detect-es-version/342593 "2023-09-08T09:33:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Piyush\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/piyush_jain/32/125444_2.png) [@Piyush\_Jain](https://discuss.elastic.co/u/Piyush_Jain)\
**Post date:** [September 8, 2023, 9:33am UTC](https://discuss.elastic.co/t/eshadoopillegalargumentexception-cannot-detect-es-version/342593/1 "2023-09-08T09:33:57Z")

</div>

I'm getting error  
_"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'm using pyspark to write my dataframe to elasticsearch cluster like this:

```auto
df1.write.format("org.elasticsearch.spark.sql")\
    .option("es.nodes", host)\
    .option("es.port", port)\
    .option("es.net.http.auth.user", username)\
    .option("es.net.http.auth.pass", password)\
    .option("es.resource", indexName)\
    .option("es.net.ssl.keystore.location", pathToCAFile))\
    .mode('overwrite')\
    .save()

```

I've tried wan only options but they make no difference.

I've checked my cluster connectivity using curl, it's working totally fine and I'm able to connect to elasticsearch server using python also but Pyspark is giving me hardtime here. I'm using the same version of EsHadoop-jar file also as per my elasticsearch cluster version.

Please help me with this issue.

---

<div class="post-metadata">

**Author:** ![Keith\_Massey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keith_massey/32/83666_2.png) [@Keith\_Massey](https://discuss.elastic.co/u/Keith_Massey)\
**Post date:** [September 8, 2023, 1:33pm UTC](https://discuss.elastic.co/t/eshadoopillegalargumentexception-cannot-detect-es-version/342593/2 "2023-09-08T13:33:00Z")

</div>

Hi @Piyush_Jain. Do all nodes in your spark cluster have access to all of your Elasticsearch nodes? You could get more information about the problem if you set logging for `org.elasticsearch.hadoop.rest` to `TRACE`. The way to do that depends on your spark distribution, but it's probably a file called `conf/log4j.properties` in your spark installation. After you do that, you ought to see a lot more logging in your pyspark logs.

---

<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:** [October 6, 2023, 1:33pm UTC](https://discuss.elastic.co/t/eshadoopillegalargumentexception-cannot-detect-es-version/342593/3 "2023-10-06T13:33:16Z")

</div>

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