DRYな備忘録

Don't Repeat Yourself.

Elasticsearchのデータをdumpしてコピーしたい

やりたいこと

あるインスタンスで動いてるElasticsearchサーバのインデックスデータのdumpを、たとえば自分のローカルにコピーしたい

こんなのがある

elasticdump

これ便利だった

最低限の使い方(書いてあるんですけど↑)

% npm install -g elasticdump
% elasticdump --input=http:/my.elasticsearch.server.com:9200/my_index --output=http://localhost:9200/my_index

あるいは、

% elasticdump --input=http://my.elasticsearch.server.com:9200/my_index --output=$ | gzip > my_index.json.gz

解凍

% gzip -dc my_index.json.gz > my_index.json
% elasticdump --input=my_index.json --output=http://localhost:9200/my_index