简体   繁体   English

弹性搜索得分差异

[英]Elastic search score discrepancy

I have only a single record in my elastic search cluster. 我的弹性搜索集群中只有一条记录。 It has the text "Foo Bar". 它带有文本“ Foo Bar”。

When I run the following query on the cluster, the score comes out to be 0.11506979 : 当我在集群上运行以下查询时, score0.11506979

{
  "size" : 100,
  "query" : {
        "query_string" : {
          "query" : "foo bar"
        }
      } 

}

However, when I run the following query (notice the * after foo bar) on the cluster, the score comes out to be 0.9798734 但是,当我在群集上运行以下查询(注意foo栏后的*)时, score0.9798734

{
  "size" : 100,
  "query" : {
        "query_string" : {
          "query" : "foo bar*"
        }
      } 
}

Why is the score more in case I add the * ? 如果加*,为什么分数会更高? Isn't there only one document to match? 是否只有一个文件可以匹配?

Why is the score more in case I add the * ? 如果加*,为什么分数会更高?

The above * matches documents that have fields matching a wildcard expression (not analyzed). 上面的*匹配具有匹配通配符表达式(未分析)的字段的文档。 It matches any character sequence (including the empty one) 它匹配任何字符序列(包括空字符)

Isn't there only one document to match? 是否只有一个文件可以匹配?

It depends on your index analyzer, how you are indexing your fields in a given document. 这取决于您的索引分析器,如何索引给定文档中的字段。 If you are using default analyzer then ES will use a standard analyzer. 如果使用默认分析仪,则ES将使用标准分析仪。 To check exactly how your indexed data is getting stored internally in ES go through this . 要准确检查索引数据如何在ES内部存储,请执行此操作

Also, regarding the actual score you should be aware of internal mechanism which is used by ES for scoring docs. 另外,关于实际分数,您应该了解ES用来对文档进行评分的内部机制。 This will help you getting a better idea of scoring mechanism. 将帮助您更好地了解评分机制。

In case of any doubts feel free to ask further questions. 如有任何疑问,请随时提问。

Thanks 谢谢

When you use wildcards like * the scoring is done using ConstantScore strategy which takes only boost and queryNorm into account . 当您使用*之类的通配符时,将使用ConstantScore策略完成评分,该策略仅考虑boost和queryNorm。 Hence the score changes . 因此,分数改变了。 pass the param explain=true to see how your score is being calculated. 通过param explain=true以查看如何计算您的分数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM