3

I have this configuration in hive-site.xml

<property>
  <name>hive.aux.jars.path</name>
  <value>/path/to/elasticsearch-hadoop-2.0.1.jar</value>
</property>

When I map data to Elasticsearch in HiveCli, it work correctly by this code:

CREATE EXTERNAL TABLE artists (...)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.resource' = 'radio/artists',
              'es.index.auto.create' = 'false')

But when I use it in Hive Java Client (I started Hiveserver2) it throw this exception:

FAILED: Execution Error, return code 1 
  from org.apache.hadoop.hive.ql.exec.DDLTask. 
        org.apache.hadoop.hive.ql.metadata.HiveException: 
  Error in loading storage handler.org.elasticsearch.hadoop.hive.EsStorageHandler
Saeed Zhiany
  • 2,051
  • 9
  • 30
  • 41
thanhtien
  • 31
  • 3

1 Answers1

2

Add elasticsearch-Hadoop-2.0.1.jar file in $HIVE_HOME/lib folder.

Edit your query- create external table artist (...) row format serde 'org.elasticsearch.hadoop.hive.EsSerDe' stored by 'org.elasticsearch.hadoop.hive.EsStorageHandler' tblproperties ( 's.resource'='radio/artists','es.index.auto.create' = 'false');

Hope it might help..

arjun045
  • 103
  • 11