Elasticsearch批量索引没有错误

时间:2018-04-12 03:29:03

标签: json elasticsearch cmd

我在cmd行(Windows)上运行下面的代码来批量索引大约300万个文档,但没有任何反应。我运行它,一秒钟后它完成没有输出,甚至没有创建索引。

 curl -H "Content-Type: application/json" -XPOST "localhost:9200/test1/_doc/_bulk" --data-binary "@huge_JSON"

我在这个文档的几行上运行相同的行,它工作正常。

在具有300k文档的文件上运行它也可以。

为什么它不起作用而且没有出错?

编辑: 无论出于何种原因,我现在都会收到错误:

curl: option --data-binary: out of memory

1 个答案:

答案 0 :(得分:0)

拆分文件(如果在Windows上使用cygwin等):

split -l 100000 huge_JSON

运行此行以索引每个拆分文件:

for %%i in (*) do curl -H "Content-Type: application/json" -XPOST "localhost:9200/test1/_doc/_bulk?pretty&refresh" --data-binary  @%%i

OR

只需使用logstash