Skip to content

Instantly share code, notes, and snippets.

@wardbekker
Created October 23, 2017 17:41
Show Gist options
  • Save wardbekker/cfe52913fb6af1275243eefa39421163 to your computer and use it in GitHub Desktop.
Save wardbekker/cfe52913fb6af1275243eefa39421163 to your computer and use it in GitHub Desktop.
Dump all local indices
INPUT=http://localhost:9200
indices=$(curl -s -XGET $INPUT/_cat/indices?h=i)
for INDEX in $indices
do
echo $INDEX
elasticdump --input=$INPUT/$INDEX --output=$ --type=data | gzip > "${INDEX}_data.json.gz"
elasticdump --input=$INPUT/$INDEX --output="${INDEX}_mapping.json" --type=mapping
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment