事情背景:
项目刚开始建立索引时候,对手机号码的类型搞错了,应该是keyword,搞成text分词了,不能精确搜索。为了避免reindex,就新增字段用来精确搜索,需要把历史数据手机号码字段赋值给新字段
脚本如下:
POST /order_test1/_update_by_query
{
"script": {
"source": "ctx._source.phoneDes = ctx._source.phone",
"params": {
"name": "phone"
}
}
}
在kibana执行结果如下
{
"took" : 773,
"timed_out" : false,
"total" : 366,
"updated" : 366,
"deleted" : 0,
"batches" : 1,
"version_conflicts" : 0,
"noops" : 0,
"retries" : {
"bulk" : 0,
"search" : 0
},
"throttled_millis" : 0,
"requests_per_second" : -1.0,
"throttled_until_millis" : 0,
"failures" : [ ]
}
注意,如果数据量很大,谨慎使用。

1398

被折叠的 条评论
为什么被折叠?



