【HIve的ES映射表数据同步-org.elasticsearch.hadoop.rest.EsHadoopRemoteException: strict_dynamic_mapping_excep】

1、在hive对ES中建映射表进行数据同步

报如下错误:org.elasticsearch.hadoop.rest.EsHadoopRemoteException: strict_dynamic_mapping_exception: mapping set to strict, dynamic introduction of [disease_mark] within [_doc] is not allowed
在这里插入图片描述

这个意思,是不允许动态在ES文档也是结构动态添加字段(也就是es中没有这个字段)
需要在建ES映射表的时候,先在ES建表,或者开启自动添加字段的配置(生产环境一般不允许,除非特殊情况)

2、建表语句

drop table if exists wedw_ods.health_bigdata_health_patient_info_search_df;
CREATE EXTERNAL TABLE wedw_ods.health_bigdata_health_patient_info_search_df(
etl_time string comment 'etl时间'
, id string comment '主键,i的card+biz_version'
, id_card string comment '居民证件号,唯一标识'
, biz_version string comment '数据版本,yyyyMMdd'
, patient_name string comment '居民姓名'
, profession string comment '职业'
, mobile string comment '手机号'
, address  string comment '住址'
, marriage_status string comment '婚姻状况,0-未婚 1-已婚 2-离异 3-丧偶'
, gender string comment '性别,0-男,1-女'
, birthday string comment '出生日期'
, age string comment '年龄'
, has_diabetes_complication int  comment '糖尿病并发症,1-有,0-无',
has_insp_record_last_year int  comment '去年是否有检查检验记录,1-有,0-无',
diabetes_inpat_amt double  comment '糖尿病门诊费用',
is_diabetes_use_tcm int  comment '糖尿病治疗是否使用中药,1-是,0-否',
last_year_pay_amt double  comment '去年处方整体消费金额',
last_year_med_pay_amt double  comment '去年处方中用药消费金额',
past_desease_history string  comment '既往病史',
is_diabetes int  comment '是否患有糖尿病,1-是,0-否',
medicare_type array<int> comment '门特患者类型,参见wedw_dwd.tjhis_all_outp_Register_df.medicaretype',
is_mt int comment '是否门特患者,1-是,0-否'
,manage_pres_cnt  int  comment '累计开具管理处方数量'
,last_manage_pres_date string comment '最新一张管理处方开具日期'
,last_update_manage_pres_date string comment '最新一张管理处方修改日期'
,first_manage_pres_date string comment '最早一张管理处方开具日期'
,diabetes_first_date string   comment '糖尿病首诊日期'
,diabetes_type string comment ' 糖尿病类型'
,diabetes_date string comment ' 糖尿病确诊时间'
,bmi_year_avg int  comment ' 一年内BMI均值'
,med_type  int comment '医保类型: 1-城镇职工、2-城乡居民、3-新农合、0-其他'
,fee_state  int  comment '是否参加人头付费,1是,0-否'
,top_visit_hospital  string comment '就诊频率最高的天津基层医院'
,is_gaoxz     int  comment '是否患有高血脂,0否,1是'
,is_guanxb    int  comment '是否患有冠心病,0否,1是'
,is_gaoxy     int  comment '是否患有高血压,0否,1是'
,is_piant     int  comment '是否患有偏瘫,0否,1是'
,is_jiet      int  comment '是否患有含截瘫,0否,1是'
,is_naogs     int  comment '是否患有含脑梗死,0否,1是'
,is_xins      int  comment '是否患有心衰,0否,1是'
,is_feixb     int  comment '是否患有肺心病,0否,1是'
,is_xingnbq   int  comment '是否患有心功能不全,0否,1是'
,past_desease_str string  comment '既往病史'
,outpatient_avg_fee double comment '近90天内患者在基层医院门诊日均费用'
,is_diabetes_sign  int comment '是否签约糖人头,1-是,0-否'
,diabetes_sign_org string comment '糖人头签约医院名称'
,diabetes_sign_org_name string comment '糖人头签约医院名称'
, drug_fee_day84_avg   double  comment '患者84天内日均用药消费'
, inpatient_day84_cnt   int  comment '患者84天内的就诊次数'
, drug_day84_cnt   int  comment '患者84天内用药品种数量'
, adjuvant_drug_day84_cnt   int  comment '患者84天内辅助用药数量'
, is_over_drug_day84   int  comment '患者是否超量开药'
,disease_type string comment '患者患病类型'
,disease_mark string comment '患者分标情况'
,zyxw string comment '患者遵医情况'
,is_stand_manage int comment '患者是否已规范管理'
,is_sign int comment '是否为糖人头在组患者'
)STORED BY  'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES(
'es.resource'='health_bigdata_health_patient_info_search@20220713/_doc',
'es.nodes'='10.60.8.103:9200,10.60.8.104:9200,10.60.8.105:9200',
'es.net.http.auth.user'='******',
'es.net.http.auth.pass'='******',
'es.read.metadata' = 'true',
'es.write.operation'='upsert',
'es.mapping.id' = 'id',
'es.batch.write.retry.count' = '6',
'es.batch.size.entries'='5000',
'es.batch.size.bytes'='5mb',
'es.index.auto.create'='false',
-- 'es.read.field.as.array.include'='medicare_type',
'es.mapping.names' = 'etl_time:etl_time,id:id,id_card:id_card,biz_version:biz_version,patient_name:patient_name,profession:profession,mobile:mobile,address:address,marriage_status:marriage_status,gender:gender,birthday:birthday,age:age,has_diabetes_complication:has_diabetes_complication,has_insp_record_last_year:has_insp_record_last_year,diabetes_inpat_amt:diabetes_inpat_amt,is_diabetes_use_tcm:is_diabetes_use_tcm,last_year_pay_amt:last_year_pay_amt,last_year_med_pay_amt:last_year_med_pay_amt,past_desease_history:past_desease_history,is_diabetes:is_diabetes,medicare_type:medicare_type,is_mt:is_mt,manage_pres_cnt:manage_pres_cnt,last_manage_pres_date:last_manage_pres_date,last_update_manage_pres_date:last_update_manage_pres_date,first_manage_pres_date:first_manage_pres_date,diabetes_first_date:diabetes_first_date,diabetes_type:diabetes_type,diabetes_date:diabetes_date,bmi_year_avg:bmi_year_avg,med_type:med_type,fee_state:fee_state,top_visit_hospital:top_visit_hospital,is_gaoxz:is_gaoxz,is_guanxb:is_guanxb,is_gaoxy:is_gaoxy,is_piant:is_piant,is_jiet:is_jiet,is_naogs:is_naogs,is_xins:is_xins,is_feixb:is_feixb,is_xingnbq:is_xingnbq,past_desease_str:past_desease_str,outpatient_avg_fee:outpatient_avg_fee,is_diabetes_sign:is_diabetes_sign,diabetes_sign_org:diabetes_sign_org,diabetes_sign_org_name:diabetes_sign_org_name,drug_fee_day84_avg:drug_fee_day84_avg,inpatient_day84_cnt:inpatient_day84_cnt,drug_day84_cnt:drug_day84_cnt,adjuvant_drug_day84_cnt:adjuvant_drug_day84_cnt,is_over_drug_day84:is_over_drug_day84,disease_type:disease_type,disease_mark:disease_mark,zyxw:zyxw,is_stand_manage:is_stand_manage,is_sign:is_sign');
set mapred.max.split.size=256000000;
set mapred.min.split.size.per.node=256000000;
set mapred.min.split.size.per.rack=256000000;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

有语忆语

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值