Spring boot 如何解决org.elasticsearch.action.search.SearchPhaseExecutionException:所有碎片失败
我用的是elasticsearchSpring boot 如何解决org.elasticsearch.action.search.SearchPhaseExecutionException:所有碎片失败,spring-boot,elasticsearch,Spring Boot,elasticsearch,我用的是elasticsearch { "name" : "Angela Cairn", "cluster_name" : "prod-elastic", "cluster_uuid" : "iKkcI5FwTsGMtXacl3Qg-g", "version" : { "number" : "2.4.4", "build_hash" : "fcbb46dfd45562a9cf00c604b30849a6dec6b017", "build_timestamp
{
"name" : "Angela Cairn",
"cluster_name" : "prod-elastic",
"cluster_uuid" : "iKkcI5FwTsGMtXacl3Qg-g",
"version" : {
"number" : "2.4.4",
"build_hash" : "fcbb46dfd45562a9cf00c604b30849a6dec6b017",
"build_timestamp" : "2017-01-03T11:33:16Z",
"build_snapshot" : false,
"lucene_version" : "5.5.2"
},
"tagline" : "You Know, for Search"
}
有时我发现下面的错误,我无法找到它发生的原因和解决方法
错误
主要线索如下: QueryParsingException[解析失败];嵌套:JsonParseException[意外字符('t'(代码116)):应使用逗号分隔对象条目 ElasticSearch告诉您尝试执行的查询是无效的JSON文档 上述问题是:
{
"bool": {
"must_not" : [
{ "match":{ "status":"Inactive"} } ,
{ "match":{ "status":"Pending"} }
],
"must": [
{ "match": { "location": "Delhi" } },
{ "bool": {
"should": [
{
"multi_match" : {
"query": "thionaid \\\\\\\\\\\\\\\\\",
"type": "best_fields",
"fields": [ "name^5", "brand^3" ],
"boost":1,
"fuzziness" : "AUTO",
"prefix_length": 2
}
},
{
"multi_match" : {
"query": "thionaid \\\\\\\\\\\\\\\\\",
"type": "phrase_prefix",
"fields": [ "name^5", "brand^3" ],
"boost": 3
}
},
{
"multi_match" : {
"query": "thionaid \\\\\\\\\\\\\\\\\",
"type": "phrase_prefix",
"fields": [ "sku" ],
"boost": 5
}
}
]
}
}
]
}
}
问题是这些字符串:
“thionaid”
(反斜杠太多了)您在异常中看到了吗?QueryParsingException[未能解析];嵌套:JSParsonException[意外字符('t'(代码116)):希望逗号在[源代码]处分隔对象条目[B@6f430fbe;第1行,第238列]]}
是的,但我不知道实际问题是什么?是文档结构问题还是其他问题?查询中存在语法错误。您应该找到查询并修复它。谢谢,#robert,您能告诉我您是如何得到此结果的吗query@Devratna该查询被写入错误日志(作为query\u binary
)。它只是一个包含查询的Base64编码字符串。
{
"bool": {
"must_not" : [
{ "match":{ "status":"Inactive"} } ,
{ "match":{ "status":"Pending"} }
],
"must": [
{ "match": { "location": "Delhi" } },
{ "bool": {
"should": [
{
"multi_match" : {
"query": "thionaid \\\\\\\\\\\\\\\\\",
"type": "best_fields",
"fields": [ "name^5", "brand^3" ],
"boost":1,
"fuzziness" : "AUTO",
"prefix_length": 2
}
},
{
"multi_match" : {
"query": "thionaid \\\\\\\\\\\\\\\\\",
"type": "phrase_prefix",
"fields": [ "name^5", "brand^3" ],
"boost": 3
}
},
{
"multi_match" : {
"query": "thionaid \\\\\\\\\\\\\\\\\",
"type": "phrase_prefix",
"fields": [ "sku" ],
"boost": 5
}
}
]
}
}
]
}
}