elasticsearch 如何在elasticsearch中获得查询中的最大分数,elasticsearch,kibana,elasticsearch,Kibana" /> elasticsearch 如何在elasticsearch中获得查询中的最大分数,elasticsearch,kibana,elasticsearch,Kibana" />

elasticsearch 如何在elasticsearch中获得查询中的最大分数

elasticsearch 如何在elasticsearch中获得查询中的最大分数,elasticsearch,kibana,elasticsearch,Kibana,您好,我是弹性搜索新手,我想知道如何获得第一次查询的max_分数,然后将其与其他值进行比较。例如,如果max_score为2.6,我希望将该值与查询中所有文档的_score进行比较 GET searchentities/_search { "query": { "multi_match": { "query": "iron man", "type&

您好,我是弹性搜索新手,我想知道如何获得第一次查询的
max_分数
,然后将其与其他值进行比较。例如,如果
max_score
为2.6,我希望将该值与查询中所有文档的
_score
进行比较

GET searchentities/_search
{
  "query": {
        "multi_match": {
          "query": "iron man",
          "type": "bool_prefix",
          "fields": [
            "title",
            "title._2gram",
            "title._3gram"
          ],
          "minimum_should_match": 2
        }
      }
}
返回以下内容:

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 3,
      "relation" : "eq"
    },
    "max_score" : 2.4475412,
    "hits" : [
      {
        "_index" : "searchentities",
        "_type" : "_doc",
        "_id" : "IronMan",
        "_score" : 2.4475412,
        "_source" : {
          "id" : "Iron Man",
          "ad" : false,
          "verified" : false,
          "clicks" : 2,
          "photoID" : "5f8a9dd82ab79c00017722bb",
          "title" : "Iron Man "
        }
      },
      {
        "_index" : "searchentities",
        "_type" : "_doc",
        "_id" : "IronMan3",
        "_score" : 2.2448254,
        "_source" : {
          "id" : "Iron Man 3 ",
          "ad" : false,
          "verified" : false,
          "clicks" : 2,
          "photoID" : "5f8a9dd82ab79c00017722bb",
          "title" : "Iron Man 3 "
        }
      },
      {
        "_index" : "searchentities",
        "_type" : "_doc",
        "_id" : "IronMan2",
        "_score" : 2.2448254,
        "_source" : {
          "id" : "Iron Man 2 ",
          "ad" : false,
          "verified" : false,
          "clicks" : 20,
          "photoID" : "5f8a9dd82ab79c00017722bb",
          "title" : "Iron Man 2"
        }
      }
    ]
  }
}
我想看看

2.44-2.44 =  0 
2.44-2.24 = .2
2.44-2.24 = .2

不幸的是,在elastic中没有办法以这种方式对分数进行后期处理。 最大分数只是计算完所有分数后的最高分数。 此值在Elasticsearch中存在的后处理可能性中不可用

见:


我认为您必须编写自己的程序来处理结果并返回分数之间的差异。

不幸的是,没有办法以这种方式以弹性方式对分数进行后期处理。 最大分数只是计算完所有分数后的最高分数。 此值在Elasticsearch中存在的后处理可能性中不可用

见:

我认为你必须编写自己的程序来处理结果并返回分数差