es6.4.3不区分大小写

1、导出es原mapping
elasticdump --input=http://es01:9200/ index_name_5 --output= index_name_5.json --type=mapping

2、修改mapping信息
【a】备份原mapping
cp index_name_5.json index_name_5.json.bak
【b】在mapping文件中添加需要忽略大小写字段的属性字段
* vim index_name_5.json
* 添加"normalizer":“my_normalizer” (注意:确认要修改的字段type类型是否为keyword,当字段类型为text时,不支持该配置添加)

3、创建备份mapping
curl -XPUT es01:9200/ index_name_5_v1
curl -XPOST es01:9200/ index_name_5_v1/_close
curl -XPUT -H “Content-Type: application/json” es01:9200/ index_name_5_v1/_settings -d ‘{“settings”:{“analysis”:{“normalizer”:{“my_normalizer”:{“type”:“custom”,“filter”:[“lowercase”]}}}}}’
curl -XPOST es01:9200/ index_name_5_v1/_open
elasticdump --input= index_name_5.json --output=http://es01:9200/ index_name_5_v1 --type=mapping
curl -XPOST -H “Content-Type: application/json” es01:9200/_reindex?wait_for_completion=true -d ‘{“source”:{“index”:" index_name_5",“size”: 100},“dest”:{“index”:" index_name_5_v1"}}’

4、对比原mapping与备份mapping的数据条数是否一致
curl -XPOST -H “Content-Type: application/json” es01:9200/ index_name_5_v1/_count
curl -XPOST -H “Content-Type: application/json” es01:9200/ index_name_5/_count

5、重建旧mapping
curl -XPOST es01:9200/ index_name_5/_close
curl -XDELETE es01:9200/ index_name_5
curl -XPUT es01:9200/ index_name_5
curl -XPOST es01:9200/ index_name_5/_close
curl -XPUT -H “Content-Type: application/json” es01:9200/ index_name_5/_settings -d ‘{“settings”:{“analysis”:{“normalizer”:{“my_normalizer”:{“type”:“custom”,“filter”:[“lowercase”]}}}}}’
curl -XPOST es01:9200/ index_name_5/_open
elasticdump --input= index_name_5.json --output=http://es01:9200/ index_name_5 --type=mapping
curl -XPOST -H “Content-Type: application/json” es01:9200/_reindex?wait_for_completion=true -d ‘{“source”:{“index”:" index_name_5_v1",“size”: 100},“dest”:{“index”:" index_name_5"}}’

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值