-
-
Save calebphillips/6f2991894f5011ab38f3 to your computer and use it in GitHub Desktop.
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-2015.04.29' | |
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