ES实战-相关性搜索

ES打分机制

1.TF-IDF 词频-逆文档频率

2.Okapi BM25

3.随机性分歧- DFR相似度

4.基于信息 - IB相似度

5.LM Dirichlet 相似度

6.LM Jelinek Mercer相似度
解释一个查询的结果集

bash 复制代码
curl -XPOST 'localhost:9200/get-together/_search?pretty' -H 'Content-Type: application/json' -d '
{
  "query": {
    "match": {
      "description": "elasticsearch"
    }
  },
  "explain": true
}'

使用function_score来定制得分

bash 复制代码
#在description字段中匹配到hadoop
#和logstash的文档,分数就乘以2或3
POST /get-together/_search
{
  "query": {
    "function_score": {
      "query": {
        "match": {
          "description": "elasticsearch"
        }
      },
      "functions": [
        {
          "weight": 2,
          "filter": {
            "term": {
              "description": "hadoop"
            }
          }
        },
        {
          "weight": 3,
          "filter": {
            "term": {
              "description": "logstash"
            }
          }
        }
      ]
    }
  }
}

合并得分

1.每个单独函数得分合并 score_mode

multiply,sum,avg,first,max,min

2.函数得分和原始得分合并 boost_mode

sum,avg,max,min,replace

相关推荐
乌托邦的逃亡者10 分钟前
Linux系统中配置history命令显示时间、IP、账号和操作命令
linux·运维·安全
趙小贞15 分钟前
字符设备驱动开发流程与实战:以 LED 驱动为例
linux·c语言·驱动开发
Archy_Wang_144 分钟前
Elasticsearch8.4.1升级Elasticsearch9.1.5
运维·elasticsearch·jenkins
Wang's Blog2 小时前
Linux小课堂: Vim与Emacs之Linux文本编辑器的双雄格局及Vim安装启动详解
linux·vim·emacs
观山岳五楼2 小时前
unbuntu系统配置IPV6的三种模式
linux·服务器·ip·1024程序员节
运维行者_2 小时前
AWS云服务故障复盘——从故障中汲取的 IT 运维经验
大数据·linux·运维·服务器·人工智能·云计算·aws
王道长服务器 | 亚马逊云2 小时前
AWS Systems Manager:批量服务器管理的隐藏利器
linux·网络·云计算·智能路由器·aws
命运之光3 小时前
【快速解决】Linux服务器安装Java17运行环境
linux·运维·服务器
你喜欢喝可乐吗?3 小时前
Ubuntu服务器无法显示命令行登录提示
linux·运维·服务器·ubuntu
FJW0208144 小时前
【Linux】用户管理及优化
linux·运维·服务器