# Elasticsearch Hadoop Connection

**URL:** <https://discuss.elastic.co/t/elasticsearch-hadoop-connection/202501>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [October 7, 2019, 8:21am UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-connection/202501 "2019-10-07T08:21:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)\
**Post date:** [October 7, 2019, 8:21am UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-connection/202501/1 "2019-10-07T08:21:51Z")

</div>

Hi,

I am trying to add hive table into Elasticsearch. Have added the jar in hive-site.xml file.

CDH 5.11  
Hadoop 2.6  
Hive 1.1.0  
elasticsearch-hadoop-7.3.2.jar  
Elasticsearch 7.3.2

I am able to successfully create table using below command  
CREATE EXTERNAL TABLE elkdummy (  
name STRING,  
id INT)  
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'  
TBLPROPERTIES('es.nodes' = '192.168.4.23', 'es.resource' = 'hive-elastic/log', 'es.query' = '?q=\*');

But when I try to insert data using below command

INSERT INTO TABLE elkdummy VALUES ('elastic',1);

I get below error  
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.hadoop.hive.EsHiveInputFormat  
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)  
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)  
at java.lang.Class.forName0(Native Method)  
at java.lang.Class.forName(Class.java:348)  
at org.apache.hive.com.esotericsoftware.kryo.util.DefaultClassResolver.readName(DefaultClassResolver.java:136)  
... 49 more

I want to understand why the create query is getting executed but the insert query is not?

---

<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:** [October 16, 2019, 8:31pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-connection/202501/2 "2019-10-16T20:31:25Z")

</div>

We've seen issues when people add the jar in hive-site.xml - There are weird problems that pop up in Hive when trying to load the library when executing a query. Often times it is resolved by adding the jar to the job classpath via the `ADD JAR <...>` command before the queries are run.

---

<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:** [November 13, 2019, 8:31pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-connection/202501/3 "2019-11-13T20:31:35Z")

</div>

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