Hivesever2 cannot load the EsStorageHandler class from elasticsearch-hadoop… here is a solution to the problem.
Hivesever2 cannot load the EsStorageHandler class from elasticsearch-hadoop
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 works fine with the following 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 the Hive Java Client (I started Hiveserver2) it throws 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
Solution
Add the elasticsearch-Hadoop-2.0.1.jar file in the $HIVE_HOME/lib folder.
Edit your query-
Create an external table artist (…) Line format serde ‘org.elasticsearch.hadoop.hive.EsSerDe’ by ‘org.elasticsearch.hadoop.hive.EsStorageHandler‘ tblproperties ( ‘s.resource’ =’radio/artists’,’ es.index.auto.create’ = ‘false’);
Hope that helps