elasticsearch function_score Query——文档排序结果的最后一道墙
function_score Query
The function_score
query is the ultimate tool for taking control of the scoring process. It allows you to apply a function to each document that matches the main query in order to alter or completely replace the original query _score
.
In fact, you can apply different functions to subsets of the main result set by using filters, which gives you the best of both worlds: efficient scoring with cacheable filters.
It supports several predefined functions out of the box:
weight
- Apply a simple boost to each document without the boost being normalized: a
weight
of2
results in2 * _score
. field_value_factor
- Use the value of a field in the document to alter the
_score
, such as factoring in apopularity
count or number ofvotes
. random_score
- Use consistently random scoring to sort results differently for every user, while maintaining the same sort order for a single user.
- Decay functions—
linear
,exp
,gauss
- Incorporate sliding-scale values like
publish_date
,geo_location
, orprice
into the_score
to prefer recently published documents, documents near a latitude/longitude (lat/lon) point, or documents near a specified price point. script_score
- Use a custom script to take complete control of the scoring logic. If your needs extend beyond those of the functions in this list, write a custom script to implement the logic that you need.
Without the function_score
query, we would not be able to combine the score from a full-text query with a factor like recency. We would have to sort either by _score
or by date
; the effect of one would obliterate the effect of the other. This query allows you to blend the two together: to still sort by full-text relevance, but giving extra weight to recently published documents, or popular documents, or products that are near the user’s price point. As you can imagine, a query that supports all of this can look fairly complex. We’ll start with a simple use case and work our way up the complexity ladder.
转自:https://www.elastic.co/guide/en/elasticsearch/guide/current/function-score-query.html
elasticsearch function_score Query——文档排序结果的最后一道墙的更多相关文章
- Elasticsearch 7.x文档基本操作(CRUD)
官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html 1.添加文档 1.1.指定文档ID PUT ...
- elasticsearch 官方监控文档 老版但很有用
https://zhaoyanblog.com/page/1?s=elasticsearch 监控每个节点(jvm部分) 操作系统和进程部分 操作系统和进程部分的含义是很清楚的,这里不会描述的很详细. ...
- 【Elasticsearch学习】文档搜索全过程
在ES执行分布式搜索时,分布式搜索操作需要分散到所有相关分片,若一个索引有3个主分片,每个主分片有一个副本分片,那么搜索请求会在这6个分片中随机选择3个分片,这3个分片有可能是主分片也可能是副本分片, ...
- 5.ElasticSearch系列之文档的基本操作
1. 文档写入 # create document. 自动生成 _id POST users/_doc { "user" : "shenjian", " ...
- Elasticsearch没看文档之前,整理的一些知识
1 基础 index -> 数据库 type -> 表 document -> 行 field -> 列 ----------------------------------- ...
- Elasticsearch操作Document文档
1.利用客户端操作Document文档数据 1.1 创建一个文档(创建数据的过程,向表中去添加数据) 请求方式:Post 请求地址:es所在IP:9200/索 ...
- 关于Elasticsearch单个索引文档最大数量问题
因为ElasticSearch是一个基于Lucene的搜索服务器.Lucene的索引有个难以克服的限制,导致Elasticsearch的单个分片存在最大文档数量限制,一个索引分片的最大文档数量是20亿 ...
- elasticsearch 查询所有文档
0.添加一个索引 curl -i -XPUT http://172.31.250.16:10004/test_index/user/1 -d '{ "name": "小明 ...
- elasticsearch 基础 —— 分布式文档存储原理
路由一个文档到一个分片中 当索引一个文档的时候,文档会被存储到一个主分片中. Elasticsearch 如何知道一个文档应该存放到哪个分片中呢?当我们创建文档时,它如何决定这个文档应当被存储在分片 ...
随机推荐
- Android自定义控件之基本原理(一)
前言: 在日常的Android开发中会经常和控件打交道,有时Android提供的控件未必能满足业务的需求,这个时候就需要我们实现自定义一些控件,今天先大致了解一下自定义控件的要求和实现的基本原理. 自 ...
- Naive Bayesian文本分类器
贝叶斯学习方法中有用性非常高的一种为朴素贝叶斯学习期,常被称为朴素贝叶斯分类器. 在某些领域中与神经网络和决策树学习相当.尽管朴素贝叶斯分类器忽略单词间的依赖关系.即如果全部单词是条件独立的,但朴素贝 ...
- PS 基础知识 渐变编辑器如何使用
ps渐变编辑器在哪 [ 标签:渐变,ps 渐变,编辑器 ] _______志 敏 回答:3 人气:9 解决时间:2009-04-16 15:28 满意答案 你先点渐变工具 然后左上出现渐变条设置 如图 ...
- Push flow
自动移库规则push flow可以用来规划物流 比如产品A如果进入到picking区,按照仓储的规则,系统可以自动生产调拨单,将产品A 从picking区调拨到保存的库位货架A1E1 设置步骤 ...
- mysql性能优化-慢查询分析、优化索引和配置 MySQL索引介绍
MySQL索引介绍 聚集索引(Clustered Index)----叶子节点存放整行记录辅助索引(Secondary Index)----叶子节点存放row identifier-------Inn ...
- 手写AngularJS脏检查机制
什么是脏检查 View -> Model 浏览器提供有User Event触发事件的API,例如,click,change等 Model -> View 浏览器没有数据监测API. Ang ...
- Ejb in action(六)——拦截器
Ejb拦截器可以监听程序中的一个或全部方法.与Struts2中拦截器同名,并且他们都可以实现切面式服务.同一时候也与Spring中的AOP技术类似. 不同的是struts2的拦截器的实现原理是一层一层 ...
- POJ 1753 (枚举+DFS)
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 40632 Accepted: 17647 Descr ...
- 用python模拟TCP3次握手连接及发送数据
源码如下: from scapy.all import * import logging logging.getLogger('scapy.runtime').setLevel(logging.ERR ...
- Memcache介绍
面临的问题 对于高并发高訪问的 Web应用程序来说.数据库存取瓶颈一直是个令人头疼的问题. 特别当你的程序架构还是建立在单数据库模式,而一个数据池连接数峰值已经达到500的时候,那你的程序执行离崩溃的 ...