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

相关推荐
广州浮点FLOATLIC31 分钟前
许可证服务器迁移后软件打不开:研发 IT 怎样定位连接问题
linux·服务器·数据库
BLUcoding1 小时前
接口服务公网超时排查记录:SecureRandom 阻塞问题分析与解决
java·linux·springboot·aes·securerandom
AIgorithmGEEK1 小时前
[Linux]从手写报头到内核套路:序列化、反序列化与自定义协议全链路
linux·运维·服务器·网络·序列化·反序列化
Nil2081 小时前
leetcode 139单词拆分
linux·运维·服务器
Starry-sky(jing)1 小时前
BUG: unable to handle kernel paging request 完整排查:dmesg 四要素与三路定罪
linux·运维·服务器·内核·排障
mounter6251 小时前
从硬件互连到操作系统变革:CXL 技术演进与 Linux 内核工程挑战
linux·运维·服务器
xh didida3 小时前
Linux -- 基础IO
linux·服务器·开发语言·c++
zly35004 小时前
centos7 mount设备挂载 /dev/sda1/硬盘挂载
linux·运维·服务器
工业一体机老司机4 小时前
工业一体机选购后的系统部署:Ubuntu下Docker容器化运行与GPIO配置
linux·ubuntu·docker·人机交互
哎呦,帅小伙哦4 小时前
进程监控工具——htop
linux·运维·服务器