Last active
August 29, 2015 14:20
-
-
Save drewr/8bb7bfbda1ed315f8c79 to your computer and use it in GitHub Desktop.
Snap your marvel indices, without snapshot/restore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pat='.marvel-*' | |
idxs=`curl -s localhost:9200/_cat/indices/${pat}\?h=index | sort` | |
single=`echo $idxs | tail -1` | |
id=`echo $pat | sed 's/[^a-zA-Z]*//g'`-`date -u +%s` | |
d=/tmp/$id | |
if [ -d $d ]; then | |
echo $d exists, delete and rerun $0 | |
exit 1 | |
fi | |
mkdir $d | |
echo saving mapping | |
curl -s localhost:9200/$single/_mapping >$d/mapping.json.txt | |
for i in $idxs; do | |
echo saving $i | |
stream2es es \ | |
--source http://localhost:9200/${i} \ | |
--no-indexing \ | |
--tee-bulk $d | |
done | |
( cd $d/..; tar cf - $id ) | gzip >$id.tar.gz | |
echo created $id.tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment