影响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",

],

相关文章:

  • 2021-10-29
  • 2022-12-23
  • 2021-04-24
  • 2021-06-08
  • 2021-06-26
  • 2022-12-23
  • 2021-04-21
猜你喜欢
  • 2021-05-26
  • 2022-02-09
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
相关资源
相似解决方案