elasticdump无法从文件导入数据

时间:2018-04-16 11:52:16

标签: elasticsearch

我尝试从json文件导入数据。使用这样的命令: elasticdump --input=2016-1-1-2016-7-31-2.json --output=http://localhost:9200/格式如下:https://github.com/taskrabbit/elasticsearch-dump/blob/master/test/seeds.json 我的备份文件索引很少。但是当我开始上面写的命令时 - 得到这样的结果: Fri, 13 Apr 2018 13:36:44 GMT | starting dump Fri, 13 Apr 2018 13:36:44 GMT | got 100 objects from source file (offset: 0) Fri, 13 Apr 2018 13:36:44 GMT | sent 100 objects to destination elasticsearch, wrote 0 Fri, 13 Apr 2018 13:36:44 GMT | got 291 objects from source file (offset: 100) Fri, 13 Apr 2018 13:36:44 GMT | sent 291 objects to destination elasticsearch, wrote 0 Fri, 13 Apr 2018 13:36:44 GMT | got 292 objects from source file (offset: 391) Fri, 13 Apr 2018 13:36:45 GMT | sent 292 objects to destination elasticsearch, wrote 0 Fri, 13 Apr 2018 13:36:45 GMT | got 293 objects from source file (offset: 683) 如果我在URL中设置索引名称或通过--output-index = {INDEX} - 文件中的所有数据都会转到该索引,并在类型上分开。

我将非常感谢你的帮助!

2 个答案:

答案 0 :(得分:0)

在elasticdump命令行中

,尝试使用类型参数--type=dataindexName,例如elasticdump --input=2016-1-1-2016-7-31-2.json --output=http://localhost:9200/myIndex --type=data

答案 1 :(得分:0)

使用 Docker,您可以执行以下操作:

docker run --name es-dump --rm -ti elasticdump/elasticsearch-dump \
    --input=./2016-1-1-2016-7-31-2.json \
    --output=http://localhost:9200/2016-1-1-2016-7-31-2 \
    --type=data \
    --limit=10000