gpt4 book ai didi

json - Elasticsearch function_score与 bool

转载 作者:行者123 更新时间:2023-12-02 23:02:39 25 4
gpt4 key购买 nike

我试图结合 bool(boolean) 搜索功能。但我不知道。它给我一个错误:没有为[functions_score]注册查询。

因此,它找不到用于将functions_score应用于的查询。有什么想法吗?谢谢!

"body": {
"query": {
"functions_score": {
"query": {
"bool": {
"must": [
{
"query_string": {
"fields": [
"title",
"description"
],
"query": "zalan*",
"analyzer": "default",
"default_operator": "AND"
}
},
{
"range": {
"from": {
"lt": 1432201614
}
}
}
],
"should": [
{
"range": {
"to": {
"gt": 1432201614
}
}
},
{
"constant_score": {
"filter": {
"missing": {
"field": "to"
}
}
}
}
],
"minimum_should_match": 1
}
},
"functions": [
{
"boost_factor": 2
},
{
"field_value_factor": {
"field": "number_of_clicks",
"factor": 1.1,
"modifier": "sqrt"
}
},
{
"field_value_factor": {
"field": "webshop_popular",
"factor": 10,
"modifier": "sqrt"
}
}
]
}
},
"size": 20,
"sort": [
{
"webshop_popular": {
"order": "desc",
"mode": "avg"
}
},
{
"type": {
"order": "asc",
"mode": "avg"
}
}
]
}

最佳答案

上面的查询dsl中有一个错字,应该是function_score而不是functions_score
同样在OP中的查询中看起来不像您使用分数对结果进行排序,在这种情况下,使用函数是多余的

关于json - Elasticsearch function_score与 bool ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30370279/

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