gpt4 book ai didi

elasticsearch - bool格式错误的查询,预期为END_OBJECT,但找到FIELD_NAME

转载 作者:行者123 更新时间:2023-12-03 00:35:09 25 4
gpt4 key购买 nike

我对elasticsearch查询有问题。当我使用查询代码时,它会反馈消息[ bool(boolean) ]格式错误的查询,预期为[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"
}
}
]
}

最佳答案

您的第二个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"
}
}
]
}

关于elasticsearch - bool格式错误的查询,预期为END_OBJECT,但找到FIELD_NAME,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45992950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com