首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >弹性搜索mapper_parsing_exception

弹性搜索mapper_parsing_exception
EN

Stack Overflow用户
提问于 2016-05-05 12:27:18
回答 1查看 577关注 0票数 0

我对elasticsearch很陌生,并试图将json数据导入其中。我的数据看起来像(日志);

代码语言:javascript
复制
{ "test": "lorem", "test1": "1231", "test2": "asdasda" }
{ "test": "ipsum", "test1": "5644", "test2": "ghnghn" }
...

我还尝试了一些变体,比如:

代码语言:javascript
复制
[{ "test": "lorem", "test1": "1231", "test2": "asdasda" },
{ "test": "ipsum", "test1": "5644", "test2": "ghnn" }]

以及:

代码语言:javascript
复制
{"tests":[{ "test": "lorem", "test1": "1231", "test2": "asdasda" },
{ "test": "ipsum", "test1": "5644", "test2": "ghnn" }]}

当我运行post命令时,

代码语言:javascript
复制
"curl -XPOST "http://localhost:9200/_bulk" -d @test.json"

我得到了:

代码语言:javascript
复制
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打开了其他解决方案。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-05 12:45:31

在我看来,问题在于curl找不到test.json文件,这进一步导致了POST处理程序上游的错误。

我尝试使用一个不存在的文件,并从curl获得了相同的错误。

代码语言:javascript
复制
$ curl -XPOST http://localhost:12345/bogus -d @bogusfile
Warning: Couldn't read data from file "bogusfile", this makes an empty POST.

确保curl确实找到了test.json文件并从中读取数据。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37050606

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档