发送数据时出现ElasticSearch错误
我正在尝试将JSON发送到elasticSearch。我尝试使用Postman和SOAPUI数据是
[{"column1": "abc", "column2": "def", "column3": "dghi", "column4": "jkl", "column5": "mno"}, {"column1": "pqr", "column2": "stu", "column3": "vwx", "column4": "", "column5": ""}]
我回来了以下错误
{ "error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse",
"caused_by": {
"type": "not_x_content_exception",
"reason": "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
}
},
"status": 400
}
但是当我发布单个JSON数组即
{"column1": "abc", "column2": "def", "column3": "dghi", "column4": "jkl", "column5": "mno"}
然后工作正常。我是ElasticSearch的新手,所以不确定出什么问题。
回答:
首先尝试使用大括号,然后为数组命名。尝试一下,看看是否可行。
例如:
{root:[1, 2, 3, 4, 5]}
可能有效,因为它包含在对象内部。
更好 在尝试时JSON.stringify();
,我发现它可以将数组隐式转换为JSON,如下所示:
{1, 2, 3, 4, 5}
以上是 发送数据时出现ElasticSearch错误 的全部内容, 来源链接: utcz.com/qa/435504.html