# Error When Writing to S3 from Hive External Table Over ElasticSearch

**URL:** <https://discuss.elastic.co/t/error-when-writing-to-s3-from-hive-external-table-over-elasticsearch/60411>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [September 13, 2016, 5:00pm UTC](https://discuss.elastic.co/t/error-when-writing-to-s3-from-hive-external-table-over-elasticsearch/60411 "2016-09-13T17:00:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kcs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kcs/32/11889_2.png) [@kcs](https://discuss.elastic.co/u/kcs)\
**Post date:** [September 13, 2016, 5:00pm UTC](https://discuss.elastic.co/t/error-when-writing-to-s3-from-hive-external-table-over-elasticsearch/60411/1 "2016-09-13T17:00:21Z")

</div>

We have set up an external table over elasticsearch using the following method: [https://www.elastic.co/guide/en/elasticsearch/hadoop/current/hive.html](https://www.elastic.co/guide/en/elasticsearch/hadoop/current/hive.html)

It works great. We are table to query our indexes in Hive.

However, we want to write the results of these queries to an S3 external table. When we try this, we run across: "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'"

We have specified 'es.nodes.wan.only'='true' in our create table statement. And, we only get this error when writing the results of a query to s3. Any ideas what we're doing wrong?

Any help is much appreciated.

DROP TABLE IF EXISTS exampletable1;  
CREATE EXTERNAL TABLE exampletable1 (  
example\_field STRING,  
example\_field2 TIMESTAMP ,  
example\_field3 STRUCT\<example\_field4:STRING, example\_field5:STRING\>,  
example\_field6 DOUBLE  
)  
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'  
TBLPROPERTIES('es.resource' = 'exampleindex/examplemapping','es.nodes'='url:AWS PORT','es.nodes.wan.only' = 'true');

DROP TABLE IF EXISTS exampletable2;  
CREATE EXTERNAL TABLE exampletable2 (  
example\_field STRING,  
example\_field2 TIMESTAMP,  
example\_field3 STRUCT\<example\_field4:STRING, example\_field5:STRING\>,  
example\_field6 DOUBLE  
)  
LOCATION 'example s3 location';

INSERT OVERWRITE TABLE exampletable2  
SELECT \* FROM exampletable1;

---

<div class="post-metadata">

**Author:** ![kcs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kcs/32/11889_2.png) [@kcs](https://discuss.elastic.co/u/kcs)\
**Post date:** [September 14, 2016, 8:16pm UTC](https://discuss.elastic.co/t/error-when-writing-to-s3-from-hive-external-table-over-elasticsearch/60411/2 "2016-09-14T20:16:40Z")

</div>

We found that it was a permissions issue on our side. We had only given access to our elasticsearch cluster to the master node of our EMR cluster. All nodes in the EMR cluster need access.

---

<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:** [July 6, 2017, 1:23pm UTC](https://discuss.elastic.co/t/error-when-writing-to-s3-from-hive-external-table-over-elasticsearch/60411/3 "2017-07-06T13:23:13Z")

</div>


