我希望有一个函数,可以在满足过滤条件的情况下对所有结果进行排序。我已经尝试了以下查询,但没有结果。有人能帮忙解决吗?
尝试1:
在最后一行代码中,我遇到了一个错误:没有注册名为[weight]的函数。是否支持用于过滤器的weight?可以帮忙吗?
尝试1:
{
"query": {
"function_score": {
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"bool": {
"must": [
{
"term": {
"category_boats": "motor_boat"
}
}
]
}
}
}
},
"functions": [
],
"score_mode": "first"
}
}
}
尝试2:
{
"query": {
"function_score": {
"query": {
"match_all": {}
},
"functions": [
{
"filter": {
"term": {
"boat_type": "offshore_yacht"
}
},
"weight": 1
},
{
"filter": {
"term": {
"year_built": "2016"
}
},
"weight": 1
},
{
"filter": {
"term": {
"manufacturer": "MasterCraft"
}
},
"weight": 2
}
],
"score_mode": "first"
}
}
}
在最后一行代码中,我遇到了一个错误:没有注册名为[weight]的函数。是否支持用于过滤器的weight?可以帮忙吗?