一、参考
elasticsearch 学习系列目录——更新 ing
二、示例
2.1 批改字段名称
批改字段名称,即先删除原来字段,赋值新字段
POST _reindex
{
"source": {"index": "yztest"},
"dest": {"index": "yztest1"},
"script": {
"lang": "painless",
"source": """
for (item in params.updateFields){if (ctx._source.containsKey(item)){
def newItem = "df_" + item;
ctx['_source'][newItem] = ctx._source.remove(item);
}
}
""","params": {"updateFields": ["f1","f2"]
}
}
}