Skip to content

Instantly share code, notes, and snippets.

@sursir
Last active December 7, 2018 10:19
Show Gist options
  • Select an option

  • Save sursir/2119491cb72f36a6f034c931a7653e98 to your computer and use it in GitHub Desktop.

Select an option

Save sursir/2119491cb72f36a6f034c931a7653e98 to your computer and use it in GitHub Desktop.
elasticsearch reindex 备份 迁移 migrate
reindex.remote.whitelist: "REMOTE_HOST:9200"
# username 与 password 是 basic auth
curl -X POST "localhost:9200/_reindex" -H 'Content-Type: application/json' -d'
{
"source": {
"remote": {
"host": "http://192.168.2.1:80/esmigrate",
"username": "USERNAME",
"password": "USERPASS"
},
"index": "indexname-*"
},
"dest": {
"index": "indexname"
},
"script": {
"lang": "painless",
"source": "ctx._index = \"indexname-\" + (ctx._index.substring(\"indexname-\".length(), ctx._index.length())) + \"-1\""
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment