1.同集群reindex
POST _reindex
{
"source": {
"index": "twitter"
},
"dest": {
"index": "new_twitter"
}
}
2.跨集群reindex
POST _reindex
{
"source": {
"remote": {
"host": "http://oldhost:9200",
"username": "user",
"password": "pass"
},
"index": "source",
"query": {
"match": {
"test": "data"
}
}
},
"dest": {
"index": "dest"
}
}
3.reindex操作注意事项
-跨集群reindex需要在写入数据的集群上添加远程集群的白名单,例如,需要将A集群(http://172.168.1.1:9200)数据reindex到B集群(http://172.168.1.2:9200),则A为远程集群,需要在B集群上操作,且B集群上各节点需要新增下面的配置
reindex.remote.whitelist: 172.168.1.1:9200
|