我对elasticsearch查询有一些问题。当我使用查询代码时,它反馈消息布尔格式错误的查询,应该是END_OBJECT,但找到了FIELD_NAME。
{
"from":0,
"size":15,
"query":{
"bool":{
"must":[
{
"multi_match":{
"query":"books",
"fields":[
"title^20",
"lead^10",
"content"
],
"type":"phrase"
}
}
]
},
"must":{
"match":{
"groupid":"599e4b49239cfa0a5a5f189d"
}
}
},
"sort":[
{
"times":{
"order":"desc"
}
}
]
}
发布于 2017-09-01 03:36:49
第二个must
子句的位置不正确,它必须位于现有bool/must
查询内。您需要将您的查询重写为:
{
"from":0,
"size":15,
"query":{
"bool":{
"must":[
{
"multi_match":{
"query":"books",
"fields":[
"title^20",
"lead^10",
"content"
],
"type":"phrase"
}
},
{
"match":{
"groupid": "599e4b49239cfa0a5a5f189d"
}
}
]
}
},
"sort":[
{
"times":{
"order":"desc"
}
}
]
}
https://stackoverflow.com/questions/45992950
复制