我有以下查询,结果令人满意,但结果的顺序不符合过滤器的应用。
结果的顺序应该是: a1.in a2.in a3.in
但结果未按过滤器排序。
我的问题是我如何根据应用的过滤器按结果排序?
提前感谢。
以下是我正在使用的查询
post /mycity/_search?_source=meta_description,url,h1tag
{
"query": {
"function_score":{
"query":{
"match_phrase_prefix": {
"meta_description.edgegrm": {
"query": "best restaurant",
"prefix_length": 1,
"max_expansions": 5,
"slop":10,
"minimum_should_match":"75%"
}
}
},
"query":{
"match_phrase_prefix": {
"content.edgegrm": {
"query": "best restaurant",
"prefix_length": 1,
"max_expansions": 5,
"slop":10,
"minimum_should_match":"75%"
}
}
},
"functions":[
{
"filter":{"term": {
"host": "www.a1.in/city"
}},
"weight":100
},
{
"filter":{
"term": {
"host": "www.a2.in/city"
}
},
"weight":50
},
{
"filter":{
"term": {
"host": "www.a3.in/city"
}
},
"weight":25
}
],
"score_mode": "sum"
}
},
"from":0,
"size":100
}
答案 0 :(得分:1)
尝试将boost_mode设置为sum。