版本:
elasticsearch 5.5.2
elasticdump 2.2
系统 CentOS7.3
因项目需求 从生产导出一份索引到测试
帮助文档 https://github.com/taskrabbit/elasticsearch-dump?utm_source=dbweekly&utm_medium=email
安装 yum install elasticdump
elasticdump --input=http://localhost:9200 --output=abc.json --type=data Sun, 25 Sep 2016 13:07:15 GMT | starting dump Sun, 25 Sep 2016 13:07:15 GMT | Error Emitted => {"error":{"root_cause":[{"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36}],"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36},"status":400} Sun, 25 Sep 2016 13:07:15 GMT | Total Writes: 0 Sun, 25 Sep 2016 13:07:15 GMT | dump ended with error (get phase) => Error: {"error":{"root_cause":[{"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36}],"type":"parsing_exception","reason":"The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored","line":1,"col":36},"status":400}
As a workaround, the following works:
elasticdump --input=http://9.11.8.51:9200/apm --output=apm.json --type=data --searchBody '{"query": { "match_all": {} }, "stored_fields": ["*"], "_source": true }'
elasticdump --input=apm.json --output=http://9.1.8.234:9200/apm --type=data --searchBody '{"query": { "match_all": {} }, "stored_fields": ["*"], "_source": true }'
elasticdump --input=http://9.11.8.52:9200/metric --output=/data/metric.json --type=data --limit=1000 --searchBody '{"query":{"term":{"timestamp": "2018-09-28"}}}' https://github.com/taskrabbit/elasticsearch-dump