ElasticSearch6 影响_score的两种方式


影响score两种方式都要用到 function_score

1. field_value_factor

        "function_score" => [
                    "query" => [
                        "bool" => [
                            "must" => [
                                ["term" => ["title" => $xx]],
                               
                            ],
                            "must_not" => [
                                "terms" => ["xx" => "xx"],
                            ],
                        ],
                    ],
                    "field_value_factor" => [
                        "field" => "replies",
                        "modifier" => "log1p"
                     ]
                    "boost_mode" => "sum",



                ]

 

2. field_value_factor

"function_score" => [
"query" => [
"bool" => [
"must" => [
          ["term" => ["title" => $xx]]
            ],
],
],

"script_score" => [
"script" => "return (doc['a'].value * 0.6 + doc['b'].value * 0.2 + doc['c'].value * 0.1 + doc['d'].value * 0.1) * _score"
],
"boost_mode" => "replace",

],


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM