Skip to content

Instantly share code, notes, and snippets.

@det-peralta
Last active October 18, 2019 14:22
Show Gist options
  • Save det-peralta/4d9cc81759c7a94070f3085f08569b0a to your computer and use it in GitHub Desktop.
Save det-peralta/4d9cc81759c7a94070f3085f08569b0a to your computer and use it in GitHub Desktop.
Use elasticdump to export/import data from elasticsearch
#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
@det-peralta
Copy link
Author

det-peralta commented Oct 18, 2019

(curl -sL "https://gist.githubusercontent.com/det-peralta/4d9cc81759c7a94070f3085f08569b0a/raw/17b2514fa931894d47ec5b5637f1b9fa242986b1/elasticdump_export.sh" | bash -s localhost:9200/index mapping)

@det-peralta
Copy link
Author

det-peralta commented Oct 18, 2019

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