我刚打酱油去了,不好意思

ES如何修改字段里面的值

Elasticsearch | 作者 manman | 发布于2019年01月04日 | 阅读数:16460

我ES有个字段叫category,现在里面存的值都是中文,我现在想批量修改,把中文换成英文的,我用aggs 查询语句查询的结果如下
POST testing/_search?size=0
{
"aggs": {
"category_stats": {
"terms": {
"field": "category",
"size": 25
}
}
}
}
得到的结果是:
 
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 39597,
"max_score": 0,
"hits": []
},
"aggregations": {
"category_stats": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "中餐",
"doc_count": 10446
},
{
"key": "西餐",
"doc_count": 6050
},
{
"key": "酒水",
"doc_count": 4864
},
{
"key": "甜点",
"doc_count": 4147
},
{
"key": "水果",
"doc_count": 2963
},
{
"key": "香烟",
"doc_count": 2422
},
.
.
.
.
.

]
}
}
}
现在有没有什么办法,可以直接在kibana里面操作,直接替换这些中文成英文.例如6050个'西餐'全部替换成'west food'
 
已邀请:

bellengao - 博客: https://www.jianshu.com/u/e0088e3e2127

赞同来自: HelloClyde

使用update_by_query API:https://www.elastic.co/guide/e ... .html
定义script进行修改

juin - 大数据开发

赞同来自:

是要进行可视化还是调用api 查询ES中的数据?

要回复问题请先登录注册