-1
我有以下查询的结果是满意的,但结果的顺序不根据施加滤波器的阶数。Elasticsearch如何通过过滤查询
结果的顺序应该是: 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
}
对于迟到的回复感到抱歉。你的建议很完美。 – austin
很高兴提供帮助。 upvote,如果你喜欢。 –