dis_max
dis_max 支持多子句查询,子句之间是or的关系,如果两个子句都匹配到相同的文档,取最高子句分值作为文档分值。
GET search_data/_search
{
"size": 120,
"_source": "title",
"query": {
"dis_max" : {
"queries" : [
{ "match": { "title" : "日历" }},
{ "term" : { "title": "青春" }}
],
"tie_breaker" : 1
}
}
}
查询结果:
{
"_index" : "search_data",
"_type" : "_doc",
"_id" : "1016324",
"_score" : 20.455635,
"_ignored" : [
"xk_last_create_time"
],
"_source" : {
"title" : "青春飞扬日历邀请函"
}
},
{
"_index" : "search_data",
"_type" : "_doc",
"_id" : "469400",
"_score" : 14.045259,
"_ignored" : [
"xk_last_create_time"
],
"_source" : {
"title" : "2018新年日历音乐相册"
}
}
-
tie_breaker
取值[0-1],如果tie_breaker 参数大于0,那么分值会取最大子句分值+其它子句分值*tie_breaker
网友评论