Last active
October 18, 2019 14:22
-
-
Save det-peralta/4d9cc81759c7a94070f3085f08569b0a to your computer and use it in GitHub Desktop.
Use elasticdump to export/import data from elasticsearch
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
#https://github.com/taskrabbit/elasticsearch-dump | |
#!/bin/sh | |
yum install -y gcc-c++ make | |
curl -sL https://rpm.nodesource.com/setup_12.x | bash - | |
yum install -y nodejs | |
npm install elasticdump -g --no-bin-link | |
export NODE_TLS_REJECT_UNAUTHORIZED=0 | |
echo "localhost:9200/index mapping|data" | |
/usr/lib/node_modules/elasticdump/bin/elasticdump \ | |
--input=https://elastic:elastic@$1 \ | |
--output=/tmp/export-$2.json\ | |
--type=$2 |
export NODE_TLS_REJECT_UNAUTHORIZED=0 && /usr/local/lib/node_modules/elasticdump/bin/elasticdump --input=https://elastic:elastic@localhost:9200/ao --output=/tmp/export-mapping.json --type=mapping
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(curl -sL "https://gist.githubusercontent.com/det-peralta/4d9cc81759c7a94070f3085f08569b0a/raw/17b2514fa931894d47ec5b5637f1b9fa242986b1/elasticdump_export.sh" | bash -s localhost:9200/index mapping)