# How Hive connect to Elasticsearch when X-Pack installed

**URL:** <https://discuss.elastic.co/t/how-hive-connect-to-elasticsearch-when-x-pack-installed/92407>\
**Category:** Elasticsearch\
**Created:** [July 10, 2017, 3:03am UTC](https://discuss.elastic.co/t/how-hive-connect-to-elasticsearch-when-x-pack-installed/92407 "2017-07-10T03:03:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![huzhengkai](https://avatars.discourse-cdn.com/v4/letter/h/e8c25b/32.png) [@huzhengkai](https://discuss.elastic.co/u/huzhengkai)\
**Post date:** [July 10, 2017, 3:03am UTC](https://discuss.elastic.co/t/how-hive-connect-to-elasticsearch-when-x-pack-installed/92407/1 "2017-07-10T03:03:41Z")

</div>

Before i install the X-Pack,I execute the following in the Hive：

```
CREATE EXTERNAL TABLE T_TEMP_SALES_INFO(id string,loan_no string,str_no string) STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' TBLPROPERTIES('es.nodes' = '192.168.70.117:9200,192.168.70.122:9200,192.168.70.118:9200,192.168.70.119:9200,192.168.70.120:9200','es.resource'='temp_sales_info/type','es.read.metadata'='true','pushdown'='true','es.mapping.names'='id:_metadata._id,loan_no:loan_no,str_no:str_no');

```

The SQL will be OK.But After I install X-Pack,the SQL will report the error:

```
Error: org.apache.spark.sql.execution.QueryExecutionException: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. 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' (state=,code=0)

```

I want to know how to solve this!!!

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 10, 2017, 3:26am UTC](https://discuss.elastic.co/t/how-hive-connect-to-elasticsearch-when-x-pack-installed/92407/2 "2017-07-10T03:26:34Z")

</div>

Have you [configured security](https://www.elastic.co/guide/en/elasticsearch/hadoop/5.4/security.html) for ES-Hadoop?

When you install X-Pack for Elasticsearch, it automatically enables user authentication for all connections. You need to instruct Hadoop/Hive to send a username/password (or PKI certificates) when connecting to ES.

---

<div class="post-metadata">

**Author:** ![huzhengkai](https://avatars.discourse-cdn.com/v4/letter/h/e8c25b/32.png) [@huzhengkai](https://discuss.elastic.co/u/huzhengkai)\
**Post date:** [July 10, 2017, 3:36am UTC](https://discuss.elastic.co/t/how-hive-connect-to-elasticsearch-when-x-pack-installed/92407/3 "2017-07-10T03:36:13Z")

</div>

I just specify 'es.username' and 'es.password',however,it report the same error.

---

<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:** [August 7, 2017, 3:36am UTC](https://discuss.elastic.co/t/how-hive-connect-to-elasticsearch-when-x-pack-installed/92407/4 "2017-08-07T03:36:17Z")

</div>

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