elasticsearch - “best fields”查询的ElasticSearch分数未按预期工作

标签 elasticsearch relevance

试图了解排名如何运作。我的索引是在所有字段上使用“英语”分析器定义的。

这是我的查询:

GET test_index_1/study/_search/
{ 
 "query": {

    "multi_match" : {
      "query": "stupid question", 
      "type": "best_fields",
      "fields": ["description", "title",   "questions.text" ]

    }
  }

}

以下是返回的结果。测试索引中只有3个文档。

我想知道为什么第一个文档的分数是第二个文档的两倍。

直观地,“标题”和“描述”字段是“相等”的:为什么“标题”中的匹配项得分更高?
"hits": {
"total": 3,
"max_score": 1.7600523,
"hits": [
  {
    "_index": "test_index_1",
    "_type": "study",
    "_id": "AV28gnhD1DC3_uN8bTrd",
    "_score": 1.7600523,
    "_source": {
      "title": "stupid question",
      "description": "test test",
      "questions": [
        {
          "text": "stupid text"
        }
      ]
    }
  },
  {
    "_index": "test_index_1",
    "_type": "study",
    "_id": "AV28gomD1DC3_uN8bTre",
    "_score": 0.84339964,
    "_source": {
      "title": "test test",
      "description": "stupid question",
      "questions": [
        {
          "text": "stupid text"
        }
      ]
    }
  },
  {
    "_index": "test_index_1",
    "_type": "study",
    "_id": "AV28gpPT1DC3_uN8bTrf",
    "_score": 0.84339964,
    "_source": {
      "title": "test test",
      "description": "stupid question",
      "questions": [
        {
          "text": "no text"
        }
      ]
    }
  }
]

预先感谢您的任何提示。

最佳答案

Elasticsearch使用反向索引和tfidf。因此,对在所有文档中一起出现的单词的重视程度更高。单词“愚蠢”和“问题”在所有标题中仅出现一次(仅在第一个结果中),但是在所有描述中它们出现两次,两次出现(在第二个和第三个结果中),因此标题中的“愚蠢问题”更多有值(value),因为它发生的次数更少。这就是为什么第一个文档中的分数更高的原因。

关于elasticsearch - “best fields”查询的ElasticSearch分数未按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45547513/

相关文章:

elasticsearch - Kibana Discover:过滤器错误,异常

spring-boot - java.lang.IllegalStateException : Failed to load ApplicationContext , springboot设置

elasticsearch - 当文档不存在时,Upsert不会添加新的(ElasticSearch)

algorithm - 如何计算两个单词或短语的相关性?

search - 如何编写 Solr FunctionQuery 来增强包含 future 日期的文档?

ruby-on-rails - ElasticSearch:如何正确映射关联以便它们也可搜索?

elasticsearch - 在进行强制合并时,Elasticsearch 7.9 的 max_num_segments 使用什么值?

c# - 自适应用户界面/环境算法

elasticsearch - 在elasticsearch的较早位置为包含搜索查询的匹配项分配较高的分数

elasticsearch - Elasticsearch 。 _Score 在聚合中为 null。为什么?