我想要一个函数,它获取所有结果,并且仅在它们与过滤器匹配时才对它们进行排序。我已经尝试过这些查询,但没有结果。有人可以帮忙吗?
试用1:
{
"query": {
"function_score": {
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"bool": {
"must": [
{
"term": {
"category_boats": "motor_boat"
}
}
]
}
}
}
},
"functions": [
],
"score_mode": "first"
}
}
}
Run Code Online (Sandbox Code Playgroud)
试用2:
{
"query": {
"function_score": {
"query": {
"match_all": {}
},
"functions": [
{
"filter": {
"term": {
"boat_type": "offshore_yacht"
}
},
"weight": 1
},
{
"filter": {
"term": {
"year_built": "2016"
}
},
"weight": 1
},
{ …Run Code Online (Sandbox Code Playgroud)