Forked from nbigot/elsticsearch_reindex_example.sh
Created
February 24, 2021 08:42
-
-
Save jhidalgo3/38fce604cb55ece1844967d7397ddc60 to your computer and use it in GitHub Desktop.
elasticsearch reindex from remote host example
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
# show indices on this host | |
curl 'localhost:9200/_cat/indices?v' | |
# edit elasticsearch configuration file to allow remote indexing | |
sudo vi /etc/elasticsearch/elasticsearch.yml | |
## copy the line below somewhere in the file | |
>>> | |
# --- whitelist for remote indexing --- | |
reindex.remote.whitelist: my-remote-machine.my-domain.com:9200 | |
<<< | |
# restart elaticsearch service | |
sudo systemctl restart elasticsearch | |
# run reindex from remote machine to copy the index named filebeat-2016.12.01 | |
curl -XPOST 127.0.0.1:9200/_reindex?pretty -d'{ | |
"source": { | |
"remote": { | |
"host": "http://my-remote-machine.my-domain.com:9200" | |
}, | |
"index": "filebeat-2016.12.01" | |
}, | |
"dest": { | |
"index": "filebeat-2016.12.01" | |
} | |
}' | |
# verify index has been copied | |
curl 'localhost:9200/_cat/indices?v' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment