本文介绍了 elasticsearch reindex 重建索引 脚本处理 数组list组装
elasticsearch中很多时候需要 导数据或者版本升级 或者备份数据的情况下需要重建索引 这里使用到 _reindex rest接口
代码实例参考:
POST _reindex
{
"source": {
"index": "goods01",
"_source": ["goodsId", "goodsName","a1","a2"]
},
"dest": {
"index": "goods02"
},
"script":{
"source":"ArrayList klist = new ArrayList();klist.add(ctx._source.a1);klist.add(ctx._source.a2);ctx._source.aList = klist;",
"lang":"painless"
}
}
这里使用了 painless脚本对原数据做了处理 ,aList字段 的值 处理成了list形式。
发表评论
取消回复