다른 index 로 reindex 하기 전에 allocation.enable 옵션을 all 로 변경 후 진행하여야 한다.
#!/bin/bash
HOST=localhost
PORT=9200
source_index=$1
dest_index=$2
curl -XPUT "http://$HOST:$PORT/_cluster/settings?pretty" -d '{"persistent":{"cluster.routing.allocation.enable":"all"}}' -H 'Content-Type: application/json'
curl -X POST "http://$HOST:${PORT}/_reindex?pretty" -H 'Content-Type: application/json' -d'
{
"source": {
"index": "'"$source_index"'"
},
"dest": {
"index": "'"$dest_index"'"
}
}
반응형