我不熟悉elasticsearch
,并尝试将json数据导入其中。我的数据看起来像(logstash)
{ "test": "lorem", "test1": "1231", "test2": "asdasda" }
{ "test": "ipsum", "test1": "5644", "test2": "ghnghn" }
...
我也尝试了一些变化,比如:
^{pr2}$以及:
{"tests":[{ "test": "lorem", "test1": "1231", "test2": "asdasda" },
{ "test": "ipsum", "test1": "5644", "test2": "ghnn" }]}
当我运行post
命令时
"curl -XPOST "http://localhost:9200/_bulk" -d @test.json"
我得到了:
Warning: Couldn't read data from file "test.json", this makes an empty POST.
{"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to derivexcontent"}],
"type":"parse_exception","reason":"Failed to derive xcontent"},"status":400}
我还用Python打开了替代解决方案。在
在我看来,问题是
curl
找不到test.json
文件,这会进一步导致POST处理程序上游出错。在我尝试使用一个不存在的文件,并从
curl
得到相同的错误请确保
curl
确实在查找测试.json文件并从中读取数据。在相关问题 更多 >
编程相关推荐