# Connection error between apache-hive and elasticsearch

**URL:** <https://discuss.elastic.co/t/connection-error-between-apache-hive-and-elasticsearch/119453>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [February 12, 2018, 10:37am UTC](https://discuss.elastic.co/t/connection-error-between-apache-hive-and-elasticsearch/119453 "2018-02-12T10:37:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yash\_mangla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yash_mangla/32/25889_2.png) [@yash\_mangla](https://discuss.elastic.co/u/yash_mangla)\
**Post date:** [February 12, 2018, 10:37am UTC](https://discuss.elastic.co/t/connection-error-between-apache-hive-and-elasticsearch/119453/1 "2018-02-12T10:37:58Z")

</div>

Hello Folks,

I'm trying to integrate apache-hive with elasticsearch. In order to achieve same i am following below steps

**Created Table in hive:**

```
CREATE TABLE scadapass (VENDOR string, Device string, Default_Password string, Port string, Device_Type string, Protocol string, Source string) row format delimited fields terminated by ',' stored as textfile;

```

**loaded data from csv file**

```
LOAD DATA LOCAL INPATH '/home/elk/Desktop/scadapass.csv' OVERWRITE INTO TABLE scadapass;

```

**Added jar using hiveCLI**

```
add jar /home/elk/Desktop/elasticsearch-hadoop-hive-6.1.3.jar

```

Now when i'm trying to create external table

```
CREATE EXTERNAL TABLE scadapass_es (VENDOR string, Device string, Default_Password string, Port string, Device_Type string, Protocol string, Source string) STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' TBLPROPERTIES('es.resource' = 'scadapass/pass');

```

code is through following error

> ```
> 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'
> 
> ```

Please provide any help in similar direction.

Thanks,  
Yash

---

<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:** [February 13, 2018, 6:13pm UTC](https://discuss.elastic.co/t/connection-error-between-apache-hive-and-elasticsearch/119453/2 "2018-02-13T18:13:57Z")

</div>

Are you specifying the list of ES nodes to connect to?

---

<div class="post-metadata">

**Author:** ![yash\_mangla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yash_mangla/32/25889_2.png) [@yash\_mangla](https://discuss.elastic.co/u/yash_mangla)\
**Post date:** [February 13, 2018, 8:06pm UTC](https://discuss.elastic.co/t/connection-error-between-apache-hive-and-elasticsearch/119453/3 "2018-02-13T20:06:45Z")

</div>

> [@james.baiera](#):
>
> Are you specifying the list of ES nodes to connect to?

where i can specify the list of ES nodes in this process ? i'm assuming there is a jar file which i have to add in my class path using hiveCLI prompt before running the creation of external table query. and i also assuming this loaded jar file will allow me to establish a connection between hive and elastic so i can easily create table directly form hiveCLI.

if there is any changes required then let me know what sort of configuration i have to change. if you have any sample then please share the approach with us.

---

<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:** [February 13, 2018, 8:36pm UTC](https://discuss.elastic.co/t/connection-error-between-apache-hive-and-elasticsearch/119453/4 "2018-02-13T20:36:02Z")

</div>

even though the jar will provide the code to connect to Elasticsearch, you still need to use `es.nodes` to tell it where your Elasticsearch cluster is hosted. I don't see you setting `es.nodes` anywhere in your examples.

---

<div class="post-metadata">

**Author:** ![yash\_mangla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yash_mangla/32/25889_2.png) [@yash\_mangla](https://discuss.elastic.co/u/yash_mangla)\
**Post date:** [February 13, 2018, 8:50pm UTC](https://discuss.elastic.co/t/connection-error-between-apache-hive-and-elasticsearch/119453/5 "2018-02-13T20:50:38Z")

</div>

Correct, so where I have to specify es.nodes settings in hive query or somewhere else?

---

<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:** [February 13, 2018, 8:52pm UTC](https://discuss.elastic.co/t/connection-error-between-apache-hive-and-elasticsearch/119453/6 "2018-02-13T20:52:18Z")

</div>

you would specify it as part of the table properties. You can find more information about configuring the Hive integration [here](https://www.elastic.co/guide/en/elasticsearch/hadoop/current/hive.html) with additional information about configuration options [here](https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html).

---

<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 13, 2018, 8:52pm UTC](https://discuss.elastic.co/t/connection-error-between-apache-hive-and-elasticsearch/119453/7 "2018-03-13T20:52:30Z")

</div>

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