-
Notifications
You must be signed in to change notification settings - Fork 32
Dumping data to another ElasticSearch
Fernando Blat edited this page Sep 22, 2020
·
5 revisions
Install elasticdump as a global package:
sudo npm install -g elasticdump
Run the following script to export data:
#!/bin/bash
indexes=("tbi-collections" "budgets-execution-v3" "invoices" "budgets-forecast-v3" "budget-categories" "budgets-forecast-updated-v1")
for index in ${indexes[*]}; do
elasticdump --input=http://localhost:9200/$index --output=dump/$index"_mapping.json" --type=mapping
done
elasticdump --input=http://localhost:9200/tbi-collections --output=dump/tbi-collections_data.json --type=data
elasticdump --input=http://localhost:9200/budgets-execution-v3 --output=dump/budgets-execution-v3_data.json --type=data --searchBody="{\"query\":{\"term\":{\"inde_code\": \"41058\"}}}"
elasticdump --input=http://localhost:9200/budgets-forecast-v3 --output=dump/budgets-forecast-v3_data.json --type=data --searchBody="{\"query\":{\"term\":{\"inde_code\": \"41058\"}}}"
elasticdump --input=http://localhost:9200/budgets-forecast-updated-v1 --output=dump/budgets-forecast-updated-v1_data.json --type=data --searchBody="{\"query\":{\"term\":{\"inde_code\": \"41058\"}}}"
elasticdump --input=http://localhost:9200/budget-categories --output=dump/budget-categories_data.json --type=data
Run the following script to import data:
#!/bin/bash
indexes=("tbi-collections" "budgets-execution-v3" "invoices" "budgets-forecast-v3" "budget-categories" "budgets-forecast-updated-v1")
for index in ${indexes[*]}; do
elasticdump --output=http://localhost:9200/$index --input=dump/$index"_mapping.json" --type=mapping
done
elasticdump --output=http://localhost:9200/tbi-collections --input=dump/tbi-collections_data.json --type=data
elasticdump --output=http://localhost:9200/budgets-execution-v3 --input=dump/budgets-execution-v3_data.json --type=data
elasticdump --output=http://localhost:9200/budgets-forecast-v3 --input=dump/budgets-forecast-v3_data.json --type=data
elasticdump --output=http://localhost:9200/budgets-forecast-updated-v1 --input=dump/budgets-forecast-updated-v1_data.json
elasticdump --output=http://localhost:9200/budget-categories --input=dump/budget-categories_data.json --type=data