elasticsearch迁移数据

1、无密码情况

curl -X POST 'localhost:9200/_reindex?pretty' -H 'content-Type:application/json'  -d  '{"source":{"remote":{"host":"http://172.31.187.255:9200"},"size":100,"index":"x-pack","query":{"match_all":{}}},"dest":{"index":"x-pack"}}'

2、有密码情况

curl -X POST 'localhost:9200/_reindex?pretty' -H 'content-Type:application/json'  -d  '{"source":{"remote":{"host":"http://172.31.187.255:9200","username":"elastic","password":"pica_elastic@1"},"size":100,"index":"x-pack","query":{"match_all":{}}},"dest":{"index":"x-pack"}}'

3、本地服务也有密码

curl --user elastic:pica_elastic@1 -X POST 'localhost:9200/_reindex?pretty' -H 'content-Type:application/json'  -d  '{"source":{"remote":{"host":"http://172.31.187.255:9200","username":"elastic","password":"pica_elastic@1"},"size":100,"index":"ocm_event_test","query":{"match_all":{}}},"dest":{"index":"ocm_event_test"}}'

注意:请求尽量都归为一行,避免不必要的错误。

猜你喜欢

转载自blog.csdn.net/jiahao1186/article/details/128792358