我们可以根据 Elasticsearch 中的三个字段获得三个不同的分数吗?

问题描述

我正在使用带有 Elasticsearch 的传输器来索引和搜索记录,目前,它是使用以下命令完成的:

curl -XPOST "http://localhost:9200/_search?pretty=true" -d' { "query": { "multi_match" : { "query":    "George bush","fields": [ "first_name","last_name","full_name" ],"operator":   "and","fuzziness" : "AUTO" } } } ' -H 'Content-Type: application/json'

我已指定在 first_namelast_namefull_name 中搜索查询值,但它为每个记录提供了单个“_score”值,如下所示:

{
  "took" : 113,"timed_out" : false,"_shards" : {
    "total" : 1,"successful" : 1,"skipped" : 0,"failed" : 0
  },"hits" : {
    "total" : {
      "value" : 26,"relation" : "eq"
    },"max_score" : 15.525349,"hits" : [
      {
        "_index" : "db","_type" : "db","_id" : "60348c98d22c47e62bccfebb","_score" : 15.525349,"_source" : {
          "created_date_time" : "2021/02/17 01:44:50","designation" : "college basketball player (1950–1950) Toledo","education" : "['University of Toledo']","first_name" : "George","full_name" : "George Bush","gender" : "male","s_id" : "s_Q100766406","last_name" : null,"mother" : null,"native_name" : null,"occupation" : "['Q3665646']",}
      },

我希望根据指定的字段“first_name_score”、“last_name_score”、“full_name_score”获得 3 个不同的分数,如下所示:

{
  "took" : 113,"first_name_score" : 15.525349,"last_name_score" : 12.292016,"full_name_score" : 18.858672,

怎么做?

可以这样做吗?我是弹性搜索的初学者,所以如果有人能给我指出正确的资源,那就太好了。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)