如何从分数计算中取出(别名字段的长度)

How to take (length of the aliases field) out of score calculation

假设我们有一个人的文档,其中包含这样的姓名和别名数组:

{
   name: "Christian",
   aliases: ["נוצרי", "کریستیان" ]
}

假设我有一个文档有 10 个别名,另一个文档有 2 个别名 但它们都包含值为 کریستیان.

的别名

第一个文档的 length of field (dl) 比第二个文档大 所以第一个文档的 term frequency (tf) 比第二个文档低。最终别名少的文档的分数比另一个大。

有时我想为不同语言和不同形式的人添加更多别名,因为 he/she 更有名,但它会导致结果得分较低。我想以某种方式从我的查询计算中取出 length of the aliases field

Norms 存储字段的相对长度。

How long is the field? The shorter the field, the higher the weight. If a term appears in a short field, such as a title field, it is more likely that the content of that field is about the term than if the same term appears in a much bigger body field.

可以使用 PUT 映射禁用规范 api

PUT my_index/_mapping
{
  "properties": {
    "title": {
      "type": "text",
      "norms": false
    }
  }
}

进一步研究的链接

  1. https://www.elastic.co/guide/en/elasticsearch/guide/current/scoring-theory.html#field-norm