# Unable to create external table in elastic search using es-hadoop

**URL:** <https://discuss.elastic.co/t/unable-to-create-external-table-in-elastic-search-using-es-hadoop/72734>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [January 25, 2017, 7:02am UTC](https://discuss.elastic.co/t/unable-to-create-external-table-in-elastic-search-using-es-hadoop/72734 "2017-01-25T07:02:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gangadhar\_dantusetty](https://avatars.discourse-cdn.com/v4/letter/g/dec6dc/32.png) [@Gangadhar\_dantusetty](https://discuss.elastic.co/u/Gangadhar_dantusetty)\
**Post date:** [January 25, 2017, 7:02am UTC](https://discuss.elastic.co/t/unable-to-create-external-table-in-elastic-search-using-es-hadoop/72734/1 "2017-01-25T07:02:24Z")

</div>

**i am running a simple spark-submit job, e.g.:**

spark-submit --class com.x.y.z.logan /home/test/spark/sample.jar

**table in jar file**

hiveContext.sql("CREATE EXTERNAL TABLE IF NOT EXISTS databasename.tablename(es\_column\_name STRING) STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' TBLPROPERTIES('es.resource' = 'index\_name/log','es.mapping.names' ='tablecoulmname :es\_column\_name ', 'es.nodes' = '192.168.x.1y:9200','es.input.json' = 'false', 'es.index.read.missing.as.empty' = 'yes' ,'es.index.auto.create' = 'yes') ")

hiveContext.sql("INSERT INTO TABLE databasename.tablename SELECT s.tablecolumname FROM temporarytable s");

(ES-hadoop is working fine when we are creating external table in Hive interface and loading data into external table from hive table. it is not working when we include the same query in jar. the same jar file works fine when we are creating normal hive table. The problem here is showing the below error when we include external table in jar file )

**ERROR**  
client token: N/A  
diagnostics: User class threw exception: java.lang.RuntimeException: java.lang.RuntimeException: class org.elasticsearch.hadoop.mr.EsOutputFormat$EsOutputCommitter not org.apache.hadoop.mapred.OutputCommitter  
ApplicationMaster host: 192.168.x.y  
ApplicationMaster RPC port: 0  
queue: root.users.test  
start time: 1485286033939  
final status: FAILED  
tracking URL: some URL  
user: test  
Exception in thread "main" org.apache.spark.SparkException: Application application\_1485258812942\_0008 finished with failed status  
at org.apache.spark.deploy.yarn.Client.run(Client.scala:1035)  
at org.apache.spark.deploy.yarn.Client$.main(Client.scala:1082)  
at org.apache.spark.deploy.yarn.Client.main(Client.scala)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:606)  
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)  
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)  
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)  
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)  
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)  
17/01/24 14:27:39 INFO util.ShutdownHookManager: Shutdown hook called  
17/01/24 14:27:39 INFO util.ShutdownHookManager: Deleting directory /tmp/spark-c0cd21d0-ed0a-46c4-9171-2c6b7b55bc96

CAN ANYONE HELP ME HOW TO FIX THIS ?

---

<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:** [January 25, 2017, 11:04pm UTC](https://discuss.elastic.co/t/unable-to-create-external-table-in-elastic-search-using-es-hadoop/72734/2 "2017-01-25T23:04:44Z")

</div>

@Gangadhar_dantusetty Is there any reason that you are using the Hive integration through Spark instead of the native Spark integration? The project does not do any testing with the hiveContext in Spark, so I'm afraid that my experience with that facet is limited...

---

<div class="post-metadata">

**Author:** ![Gangadhar\_dantusetty](https://avatars.discourse-cdn.com/v4/letter/g/dec6dc/32.png) [@Gangadhar\_dantusetty](https://discuss.elastic.co/u/Gangadhar_dantusetty)\
**Post date:** [January 30, 2017, 10:43am UTC](https://discuss.elastic.co/t/unable-to-create-external-table-in-elastic-search-using-es-hadoop/72734/3 "2017-01-30T10:43:50Z")

</div>

even i tried with the native spark intergration. But it is showing the below error.

```
     diagnostics: User class threw exception: java.lang.NoClassDefFoundError: org/elasticsearch/spark/package$
     ApplicationMaster host: 192.168.x.x
     ApplicationMaster RPC port: 0
     queue: root.users.test
     start time: 1485792227843
     final status: FAILED
     tracking URL: some url 
     user: test

```

Exception in thread "main" org.apache.spark.SparkException: Application application\_1485790878058\_0002 finished with failed status  
at org.apache.spark.deploy.yarn.Client.run(Client.scala:1035)  
at org.apache.spark.deploy.yarn.Client$.main(Client.scala:1082)  
at org.apache.spark.deploy.yarn.Client.main(Client.scala)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:606)  
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)  
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)  
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)  
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)  
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)  
17/01/30 11:04:06 INFO util.ShutdownHookManager: Shutdown hook called  
17/01/30 11:04:06 INFO util.ShutdownHookManager: Deleting directory /tmp/spark-15c11bbd-b23c-4c2e-b42c-3110512db097

---

<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:** [February 27, 2017, 10:44am UTC](https://discuss.elastic.co/t/unable-to-create-external-table-in-elastic-search-using-es-hadoop/72734/4 "2017-02-27T10:44:43Z")

</div>

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