我将用下面的查询重新建立索引。
{
"source": {
"index": "demodata"
},
"dest": {
"index": "new_twitter",
"op_type": "create"
},
"script": {
"source": "ctx._source['project'] = 'Personal3'",
"lang": "painless"
}
}当项目改变时,相同的数据/索引需要用新的项目名称重新建立索引。但我正面临着冲突。我希望如果有任何更新Id的选择,我可以解决这个问题。
发布于 2021-10-25 10:24:38
如果您希望在每次重新索引数据时都生成新的ids,则需要执行以下操作:
POST _reindex
{
"source": {
"index": "demodata"
},
"dest": {
"index": "new_twitter"
},
"script": {
"source": "ctx._source['foo'] = 'Personal3'; ctx._id=null",
"lang": "painless"
}
}这个重新索引查询为每个文档创建一个null id,而elasticsearch为每个文档创建新的id。如果您对此有任何问题,请告诉我。
https://stackoverflow.com/questions/69672907
复制相似问题