参考地址:http://cwiki.apachecn.org/display/Elasticsearch/Reindex+API
1、首先插入准备数据,创建两个索引。
(1)、PUT http://IP:port/my_test1/test/1
{
"name":"张三",
"address":"重庆市潼南县",
"age":"26"
}
(2)、PUT http://IP:port/my_test2/test/2
{
"name":"张三2",
"address":"重庆市潼南县2",
"age":"26"
}
2、合并重建
POST http://IP:port/_reindex
{
"source": {
"index": ["my_test1", "my_test2"]
},
"dest": {
"index": "my_test"
}
}
3、删除合并之前的索引
DELETE http://IP:port/my_test1/
DELETE http://IP:port/my_test2/