1、--建立索引

number_of_shards:分片 number_of_replicas:副本数 index.refresh_interval:缓存策略
curl -XPUT 'http://192.168.10.69:9200/zhuanlidata9' -d '{"settings":{"number_of_shards":64,"number_of_replicas":0,"index.refresh_interval": -1}}'

2、--创建mapping

curl -X PUT '192.168.10.69:9200/zhuanlidata9/_mapping/zhuanliquanwen' -d '
{
"properties":{
"uuid":{"type":"keyword"},
"filename":{"type":"keyword"},
"lang":{"type":"keyword"},
"country":{"type":"keyword"},
"doc_number":{"type":"keyword"},
"kind":{"type":"keyword"},
"date":{"type":"keyword"},
"gazette_num":{"type":"keyword"},
"gazette_date":{"type":"keyword"},
"appl_type":{"type":"keyword"},
"appl_country":{"type":"keyword"},
"appl_doc_number":{"type":"keyword"},
"appl_date":{"type":"keyword"},
"text":{"type":"keyword"},
"invention_title":{"type":"text","analyzer":"ik_max_word","search_analyzer":"ik_max_word"},
"assignees":{"type":"text"},
"assignees_address":{"type":"text","analyzer":"ik_max_word","search_analyzer":"ik_max_word"},
"abstracts":{"type":"text","analyzer":"ik_max_word","search_analyzer":"ik_max_word"},
"applicants":{"type":"text"},
"applicants_address":{"type":"text"},
"inventors":{"type":"text"},
"agents":{"type":"text"},
"agency":{"type":"text"},
"descriptions":{"type":"text","analyzer":"ik_max_word","search_analyzer":"ik_max_word"},
"claims":{"type":"text","analyzer":"ik_max_word","search_analyzer":"ik_max_word"},
"cn_related_publication":{"type":"text"},
"cn_publication_referen":{"type":"text"},
"cn_related_document":{"type":"text"},
"priority_claims":{"type":"text"},
"reference":{"type":"text"},
"searcher":{"type":"text"}
}
}'

3、--创建hive映射ES表

--11.31上输入"hive" 然后执行如下命令。
hive
--添加jar包
add jar /data/2/zly/elasticsearch-hadoop-5.6.8/dist/elasticsearch-hadoop-5.6.8.jar;
--建立映射表
CREATE EXTERNAL TABLE test.zhuanlidata9 (
uuid string,
filename string ,
lang string ,
country string ,
doc_number string ,
kind string ,
date string ,
gazette_num string ,
gazette_date string ,
appl_type string ,
appl_country string ,
appl_doc_number string ,
appl_date string ,
text string ,
invention_title string ,
assignees string ,
assignees_address string ,
abstracts string ,
applicants string ,
applicants_address string ,
inventors string ,
agents string ,
agency string ,
descriptions string ,
claims string ,
cn_related_publication string ,
cn_publication_referen string ,
Cn_related_document string ,
priority_claims string ,
Reference string ,
Searcher string
)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES(
'es.resource' = 'zhuanlidata9/zhuanliquanwen',
'es.nodes'='192.168.10.69,192.168.10.70,192.168.10.71',
'es.port'='9200',
'es.mapping.id' = 'uuid',
'es.write.operation'='upsert'
);
--退出hive
exit;

4、--将数据load进hive映射es表/*在11.31上 修改 /data/2/zly/test_hive_es.sh 的循环次数以及表名/*

--{1..18}循环次数  mapreduce.job.running.map.limit 线程数
#!/bin/bash
for i in {1..18}
do
hive -e "
add jar /data/2/zly/elasticsearch-hadoop-5.6.8/dist/elasticsearch-hadoop-5.6.8.jar;
set mapreduce.job.running.map.limit=50;
insert into test.zhuanlidata9
select
regexp_replace(reflect(\"java.util.UUID\", \"randomUUID\"), \"-\", \"\") uuid,
filename,
lang,
country,
doc_number,
kind,
case when appl_date like '2%' then appl_date else '' end date ,
gazette_num,
gazette_date,
appl_type,
appl_country,
appl_doc_number,
case when appl_date like '2%' then appl_date else '' end appl_date ,
text,
invention_title,
assignees,
assignees_address,
abstracts,
applicants,
applicants_address,
inventors,
agents,
agency,
descriptions,
claims,
cn_related_publication,
cn_publication_referen,
Cn_related_document,
priority_claims,
Reference,
Searcher
from report_statistics.zhuanli_zlqw;
"
done

转载于:https://www.cnblogs.com/oneby/p/9187776.html

hive入ES5.6.8相关推荐

  1. hive时金额为科学记数法转为普通的数字

    1.改变入湖时的字段类型 在hive入湖的时候有时候遇到源数据库中科学计数法,如:1.2e+007,1e+006,等在hive中运算不识别,我试过入湖时改变字段的字段类型,有一定效果,我改成bigin ...

  2. 史上最详细大数据基础知识

    # **1___Hive** ## 0.0.hive基本命令 ```sql [1.分区表] --创建分区 alter table table_name add partition(分区字段='分区值' ...

  3. 大数据Hive其实一点都不难,从入坑到放弃?不存在的

    Hive 首先,我们来介绍一下什么是Hive.有些人不仅会想,Hive不就是写SQL的吗.没错,Hive和SQL的语法结构很像,其实,二者没有多大区别,甚至可以这样讲,Hive就是写SQL.但是,问题 ...

  4. 数仓回刷历史数据--hive设置动态分区,并向动态分区内刷入历史数据

    数仓回刷历史数据–hive设置动态分区,并向动态分区内刷入历史数据 内容目录 数仓回刷历史数据--hive设置动态分区,并向动态分区内刷入历史数据 一.问题介绍 二.问题解决思路 1 . 解决复杂逻辑 ...

  5. Azkaban任务调度(使用带有依赖的任务调度)【mapreduce数据清洗,数据入hive库,kylin预编译、数据分析】

    1 Azkaban任务调度管理 1.1 执行任务的脚本编写和说明 在做任务调度的过程中,要编写相应的脚本. -rwxrwxrwx 1 root root 809 6月 12 19:52 auto-ex ...

  6. hive sqoop 分区导入_Sqoop概述及shell操作

    特别说明:该专栏文章均来源自微信公众号<大数据实战演练>,欢迎关注! 一.Sqoop概述 1. 产生背景 基于传统关系型数据库的稳定性,还是有很多企业将数据存储在关系型数据库中:早期由于工 ...

  7. Hadoop集群的基本操作(四:Hive的基本操作)

    实验 目的 要求 目的: (1)掌握数据仓库工具Hive的使用: 要求: 掌握数据仓库Hive的使用: 能够正常操作数据库.表.数据: 实 验 环 境 五台独立PC式虚拟机: 主机之间有有效的网络连接 ...

  8. HIVE QL 杂记

    最近要处理用户访问日志,需要从HIVE中取数据,写了一些HIVE QL,有一点小感想,记录在此. 1. 临时表 在HIVE中进行多表连接时,可以给一些临时表命名,这样有助于理清查询语句之间的逻辑,格式 ...

  9. Hive 高频考点讲解

    1 Hive Hive 是 FaceBook 开源的一款基于 Hadoop 数据仓库工具,它可以将结构化的数据文件映射为一张表,并提供类SQL查询功能. The Apache Hive ™ data ...

最新文章

  1. 稀疏性如何为AI推理增加难度
  2. 爬虫基础-request的一些基础属性
  3. linux 查看java最大内存配置,Linux和Windows下的内存设置
  4. linux xampp nginx,nginx配置教程_如何配置nginx_nginx安装与配置详解
  5. wpf怎么让grid表格中元素显示到最顶层_一文搞定PPT中的快捷键
  6. 干货分享:什么是Java设计工厂模式?
  7. 如果有一天生你养你的两个人都走了
  8. 《MySQL——主备一致性六问六答》
  9. Topology and Geometry in OpenCascade-Face
  10. arcgis 属性表 汇总_ArcGIS之属性表编辑与字段添加
  11. inline-block的几个问题(还没解决)
  12. cocos2d-x学习之旅(二):1.2 cocos2d-x Visual Studio2010 开发环境搭建 windows 7 32位
  13. new方法、定制属性、描述符、装饰器
  14. java代码输出我喜欢你_程序员七夕如何表白:朕只爱一个皇后!(单例模式)...
  15. altium designer 常用元件封装
  16. 解决office2016显示图标异常——转载
  17. 解决Win10自动打开代理问题
  18. 【编译原理复习】第六章---- 属性文法和语法制导翻译
  19. 功能强大的黑科技APP,各种免费资源一应俱全!
  20. 2021年东城区文菁计划资金补助政策及申报条件,部分项目补贴100万

热门文章

  1. ZooKeeper未授权访问漏洞记录(影响范围:全版本,端口:2181)
  2. twisted系列教程十九–cancel deferred
  3. web开发——Flask框架
  4. QT5基础操作(一)
  5. vue i18n 国际化 使用方法
  6. WPF中制作立体效果的文字或LOGO图形
  7. Python程序,辅助微信跳一跳游戏介绍
  8. 为Eclipse安装功能扩展插件
  9. Android使用Application的好处
  10. ubuntu 中怎么安装 jdk 7