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
weightof2results in2 * _score. field_value_factor- Use the value of a field in the document to alter the
_score, such as factoring in apopularitycount 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, orpriceinto the_scoreto 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 如何知道一个文档应该存放到哪个分片中呢?当我们创建文档时,它如何决定这个文档应当被存储在分片 ...
随机推荐
- electron入门教程
1.atom/electron github: https://github.com/atom/electron 中文文档: https://github.com/atom/electron/tree ...
- Javascript中的e.keyCode大全
keycode 8 = BackSpace BackSpace keycode 9 = Tab Tab keycode 12 = Clear keycode 13 = Enter keycode 16 ...
- Qt5.1.1实现调用google地图显示
1.调用google地图工程文件 QT +=webkit QT +=webkitwidgets QT += core gui greaterThan(QT_MAJOR_VERSION, ): QT + ...
- vu 是什么
unsigned char 是无符号字符型 volatile 易变,易失的 volatile unsigned char i; 意思是定义一个无符号字符型的变量 i. 这个变量存放在内存中 ...
- uva 11127(暴力)
题意:给出一个字符串,包含0.1.*,当中×是能够替换成0或者1的,假设字符串的某个子串S有SSS这种连续反复3次出现,不是Triple-free串,问给出的字符串能够形成多少个非Triple-fre ...
- MIDI制作的相关软件
Native Instruments Kontakt(音乐采样器) fl studio 12 v12.5.0.59 汉化版水果 http://xiazai.flstudiochina.com/wm ...
- pwm驱动原理和代码实现
学这个pwm真是非常曲则,首先是看s3c2440的datasheet,全英文的,并且还有硬件的时序图(非常多是硬件的工作原理,和软件控制不相关). 看了非常久加上网上看了资料才把这个pwm弄通. 当然 ...
- 有关C/C++指针的经典面试题(转)
参考一: 有关C/C++指针的经典面试题 0.预备知识,最基础的指针 其实最基础的指针也就应该如下面代码: int a; int* p=&a; 也就是说,声明了一个int变量a,然后声明一个i ...
- C++11 并发指南四(<future> 详解一 std::promise 介绍)(转)
前面两讲<C++11 并发指南二(std::thread 详解)>,<C++11 并发指南三(std::mutex 详解)>分别介绍了 std::thread 和 std::m ...
- Kubernetes对象之ReplicaSet
系列目录 说到ReplicaSet对象,得先说说ReplicationController(简称为RC).在旧版本的Kubernetes中,只有ReplicationController对象.它的主要 ...