hive:与es交互:hive on es(外联表)

hive整合es,通过建外联表做映射,数据实际存储在es。注意:hive建内部表时数据存储在hdfs,与es建外联表时,数据存储在es里。

创建表语句demo:

CREATE EXTERNAL TABLE `es.test`(
  `id` string, 
  `keyword` string, 
  `tenderId` bigint, 
  `update_time` string, 
  `type` string, 
  `request_url` string, 
  `title` string, 
  `area` string, 
  `content` string, 
  `province` string, 
  `city` string, 
  `source` string, 
  `insert_time` string)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.resource' = 'suoyinname/wendang'     --索引名和文档名
, 'es.nodes'='172.**.***.193,172.**.1***.189,172.**.***.190'  --主机ip
, 'es.port'='9200' --主机端口
, 'es.mapping.id'='id' --
, 'es.mapping.names'='id:id, keyword:keyword, tenderId:tenderId, update_time:update_time, type:type, request_url:request_url, title:title, area:area, content:content, province:province, city:city, source:source, insert_time:insert_time');--映射字段

 参考:https://www.cnblogs.com/lnlvinso/p/7077471.html?utm_source=itdadao&utm_medium=referral

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值