环境
- 操作系统:Centos7
- 集群:CDH5.16.2
安装
-
将elasticsearch-hadoop.jar添加到hive的classpath路径中
方法1(此方法支持HDFS路径)
add jar /path/elasticsearch-hadoop.jar;
方法2(使用配置)
bin/hive -hiveconf hive.aux.jars.path=/path/elasticsearch-hadoop.jar
方法3(使用hive-site.xml配置文件)
<property> <name>hive.aux.jars.path</name> <value>/path/elasticsearch-hadoop.jar</value> <description>A comma separated list (with no spaces) of the jar files</description> </property>
创建表
CREATE EXTERNAL TABLE artists (...)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.resource' = 'radio/artists',
&#