Last active
October 22, 2019 11:56
-
-
Save Efrat19/3c29bec44b07292b91ea167df02ccfcc to your computer and use it in GitHub Desktop.
clone all elastic indexes settings & mapping
This file contains 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/bash | |
# in this script I assume you got elasticdump installed. https://github.com/taskrabbit/elasticsearch-dump | |
# if not, either run | |
# npm i -g elasticdump | |
# or use npx. | |
export SOURCE_HOST=http://localhost:9200 | |
export DEST_HOST=http://localhost:9201 | |
# clone settings | |
curl -s ${SOURCE_HOST}/_cat/indices \ | |
| awk '{ print $3 }' \ | |
| xargs -I index elasticdump \ | |
--input ${SOURCE_HOST}/index --output ${DEST_HOST}/index --type settings | |
# clone mapping | |
curl -s ${SOURCE_HOST}/_cat/indices \ | |
| awk '{ print $3 }' \ | |
| xargs -I index elasticdump \ | |
--input ${SOURCE_HOST}/index --output ${DEST_HOST}/index --type mapping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment