# Cannot detect ES version - using spark

**URL:** <https://discuss.elastic.co/t/cannot-detect-es-version-using-spark/263201>\
**Category:** Elasticsearch\
**Created:** [February 4, 2021, 6:21am UTC](https://discuss.elastic.co/t/cannot-detect-es-version-using-spark/263201 "2021-02-04T06:21:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nenad13](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@Nenad13](https://discuss.elastic.co/u/Nenad13)\
**Post date:** [February 4, 2021, 6:21am UTC](https://discuss.elastic.co/t/cannot-detect-es-version-using-spark/263201/1 "2021-02-04T06:21:44Z")

</div>

I am using and AWS Glue Job to use a Spark cluster and trying to connect to an elasticsearch node.

```
val esHost = "10.196.67.240"
val esPort = "9200"
val indexName = "xxx"

val sparkConfig = new SparkConf().set("es.nodes", esHost).set("es.port", esPort).set("es.nodes.wan.only", "true")
val sparkContext: SparkContext = new SparkContext(sparkConfig)
val glueContext: GlueContext = new GlueContext(sparkContext)
val args = GlueArgParser.getResolvedOptions(sysArgs, Seq("JOB_NAME").toArray)
Job.init(args("JOB_NAME"), glueContext, args.asJava)

val dataSource = ...
val mappedData = ...

val sqlContext = new SQLContext(sparkContext)
val outputDf = mappedData.toDF()
outputDf.saveToEs(indexName) 

Job.commit()

```

ERROR  
Exception in User Class: 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

Using ES version 7.2.0 on node  
Using JAR - elasticsearch-spark-20\_2.11-7.2.0 (I've read the versions have to match)  
ES node is an EC2 instance inside the same VPC as Glue.  
I've also tried using the fully qualified name of the server.

I've read some other posts on similar problems but all the answers given are generic crappy answers like "it's a connection issue" and then no one posts the solution if there ever was one.

---

<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:** [March 4, 2021, 6:22am UTC](https://discuss.elastic.co/t/cannot-detect-es-version-using-spark/263201/2 "2021-03-04T06:22:15Z")

</div>

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