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

相关推荐
码哝小鱼12 分钟前
firewalld封禁IP或IP段
linux·网络
鼠鼠龙年发大财18 分钟前
【x**3专享】安装SSH、XFTP、XShell、ARM Linux
linux·arm开发·ssh
txtsteve20 分钟前
es由一个集群迁移到另外一个集群es的数据迁移
大数据·elasticsearch·搜索引擎
nfgo21 分钟前
快速体验Linux发行版:DistroSea详解与操作指南
linux·ubuntu·centos
工作中的程序员23 分钟前
ES 索引或索引模板
大数据·数据库·elasticsearch
Rookie_explorers1 小时前
Linux下go环境安装、环境配置并执行第一个go程序
linux·运维·golang
weixin_424215841 小时前
shell运算实战案例-KFC点餐系统
linux·centos
小黑爱编程2 小时前
【LInux】HTTPS是如何实现安全传输的
linux·安全·https
BeyondESH2 小时前
Linux线程同步—竞态条件和互斥锁(C语言)
linux·服务器·c++
鱼饼6号2 小时前
Prometheus 上手指南
linux·运维·centos·prometheus