Last active
October 7, 2016 17:10
-
-
Save dcode/7b3ae2f987408048363b34755acb2091 to your computer and use it in GitHub Desktop.
Attempt to migrate data to old indexes. I need to do this because data types changed, but I don't want to lose the old data.
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
# Move index names from bro-YYYY.MM.DD to bro-v1-YYYY.MM.DD | |
for item in $(curl -s -n -XGET localhost:9200/_cat/indices | awk '/bro-/ { split($3,a,"-"); print a[2] }'); do | |
cat <<EOF | curl -s -n -XPOST localhost:9200/_reindex -d @- >/dev/null | |
{ "source": {"index": "bro-${item}"}, "dest": {"index": "bro.v1-${item}"} } | |
EOF | |
echo -e "\nCloned data from bro-${item} to bro.v1-${item}" | |
done |
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
for item in $(curl -s -n -XGET localhost:9200/_cat/indices | awk '/bro-/ { print $3 }'); do | |
curl -s -n -XDELETE "localhost:9200/${item}"; | |
echo -e "\n Delete ${item}"; | |
echo -e "\nDeleted data from ${item}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment