安裝node 和 node的elasticdump插件實現導入導出參考文章: https://github.com/taskrabbit/elasticsearch-dumpnode
1.安裝nodejs,百度nodejs,而後去官網下載4.4.7的版本 git
2.安裝elasticdump在命令行中運行:npm install elasticdump -ggithub
*若安裝不成功再運行下面的2條試試npm
npm install -g cnpm --registry=https://registry.npm.taobao.orgjson
cnpm install elasticdump -gwindows
brew install nodeapp
npm install elasticdumpelasticsearch
sudo yum install nodejs npm --enablerepo=epel插件
sudo yum install npm --enablerepo=epel命令行
npm install elasticdump
解釋:
elasticdump --input=master_openid_mapping.json --output=http://localhost:9200/live_jgd_v4
上述語句在windows中將master_openid_mapping.json 導入到本地的live_jdd_v4的 這個索引中,固然在這以前你的本地es中須要有master_openid_mapping對應的索引和結構
Backup index data to a file:
elasticdump \
--input=http://localhost:9200/wechat_v5_count \
--output=/Users/minglong/es_backup/my_index_mapping.json \
--type=mapping
elasticdump \
--input=http://production.es.com:9200/my_index \
--output=/Users/minglong/es_backup/my_index.json \
--type=data
Backup and index to a gzip using stdout:
elasticdump
--input=http://production.es.com:9200/my_index \
--output=$ \
| gzip >/Users/minglong/es_backup/my_index.json.gz
Backup the results of a query to a file
elasticdump \
--input=http://production.es.com:9200/my_index \
--output=query.json \
--searchBody '{"query":{"term":{"username": "admin"}}}'