原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/rank-feature.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/rank-feature.html
本地英文版地址: ../en/rank-feature.html
重要: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 当前版本文档。
rank_feature字段可以对数字进行索引,以便以后可以使用它们来提升rank_feature查询中的文档的相关性评分。
PUT my_index
{
"mappings": {
"properties": {
"pagerank": {
"type": "rank_feature"
},
"url_length": {
"type": "rank_feature",
"positive_score_impact": false
}
}
}
}
PUT my_index/_doc/1
{
"pagerank": 8,
"url_length": 22
}
GET my_index/_search
{
"query": {
"rank_feature": {
"field": "pagerank"
}
}
}
rank_feature字段仅支持单值字段和严格的正数值。
多值字段及负数值会别拒绝。
rank_feature字段不支持查询,排序和聚合。
它们只能在rank_feature查询内部使用。
rank_feature字段仅保留9个有效位的精度,这相当于大约0.4%的相对误差。
与分数负相关的特征排名应将positive_score_impact设置为false(默认为true)。
rank_feature查询将使用它来修改评分公式,使评分随着特征值的增加而减少,而不是增加。
例如,在网络搜索中,url的长度是一个常用的特征,它与分数负相关。