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 of 2 results in 2 * _score.
field_value_factor
Use the value of a field in the document to alter the _score, such as factoring in a popularity count or number of votes.
random_score
Use consistently random scoring to sort results differently for every user, while maintaining the same sort order for a single user.
Decay functionslinearexpgauss
Incorporate sliding-scale values like publish_dategeo_location, or price 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——文档排序结果的最后一道墙的更多相关文章

  1. Elasticsearch 7.x文档基本操作(CRUD)

    官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html 1.添加文档 1.1.指定文档ID PUT ...

  2. elasticsearch 官方监控文档 老版但很有用

    https://zhaoyanblog.com/page/1?s=elasticsearch 监控每个节点(jvm部分) 操作系统和进程部分 操作系统和进程部分的含义是很清楚的,这里不会描述的很详细. ...

  3. 【Elasticsearch学习】文档搜索全过程

    在ES执行分布式搜索时,分布式搜索操作需要分散到所有相关分片,若一个索引有3个主分片,每个主分片有一个副本分片,那么搜索请求会在这6个分片中随机选择3个分片,这3个分片有可能是主分片也可能是副本分片, ...

  4. 5.ElasticSearch系列之文档的基本操作

    1. 文档写入 # create document. 自动生成 _id POST users/_doc { "user" : "shenjian", " ...

  5. Elasticsearch没看文档之前,整理的一些知识

    1 基础 index -> 数据库 type -> 表 document -> 行 field -> 列 ----------------------------------- ...

  6. Elasticsearch操作Document文档

    1.利用客户端操作Document文档数据        1.1 创建一个文档(创建数据的过程,向表中去添加数据)            请求方式:Post    请求地址:es所在IP:9200/索 ...

  7. 关于Elasticsearch单个索引文档最大数量问题

    因为ElasticSearch是一个基于Lucene的搜索服务器.Lucene的索引有个难以克服的限制,导致Elasticsearch的单个分片存在最大文档数量限制,一个索引分片的最大文档数量是20亿 ...

  8. elasticsearch 查询所有文档

    0.添加一个索引 curl -i -XPUT http://172.31.250.16:10004/test_index/user/1 -d '{ "name": "小明 ...

  9. elasticsearch 基础 —— 分布式文档存储原理

    路由一个文档到一个分片中 当索引一个文档的时候,文档会被存储到一个主分片中. Elasticsearch 如何知道一个文档应该存放到哪个分片中呢?当我们创建文档时,它如何决定这个文档应当被存储在分片  ...

随机推荐

  1. Linux下Shell的快捷键(转)

    下述所有命令在Linux/Unix的shell下有效,这里以bash为主.如有出入,以你自己的服务器为准.本文所指的Linux主要指RHEL/CentOS,Unix指的是FreeBSD,这也是Unix ...

  2. ios使用http来上传图片实现方法

    if (parameters) {                int genderNumber = 1;        self.token = loginToken;        self.p ...

  3. Direct2D教程(二)来看D2D世界中的Hello,World

    引子 任何一门语言的第一个教程几乎都是Hello,world.我们也不例外,但是这里不是教大家打印Hello,world,而是编写一个简单的D2D绘制程序,让大家对Direct2D的程序结构及编程方法 ...

  4. IOS开发退出应用程序的代码

    IOS 开发中.我知道的两个退出程序的方法: 1. exit(0); 2. if([[UIApplication sharedApplication] respondsToSelector:@sele ...

  5. 页面登陆框老是乱乱的?banner跨页图片缩小之后总是在側面不能显示主要部分?哈哈~我来帮你忙~~

    有banner背景图片和登陆框的html.css排布 目的:无论页面大小,背景图片都要居中(显示图片中间主要内容,而不是側面的一些东西),登陆框基本能在页面内显示. 盒子的排列应该是这种: <d ...

  6. 百科知识 scm文件如何打开

    用scplayer打开,目前有效的下载链接将是: http://download.csdn.net/download/kevingao/2686778  

  7. iOS 摇一摇的实现

    - (void)viewDidLoad { [super viewDidLoad]; [[UIApplication sharedApplication] setApplicationSupports ...

  8. 杭电 HDU 1279 验证角谷猜想

    验证角谷猜想 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  9. Java反射及其在Android中的应用学习总结

    一. Java反射机制 Reflection 是Java被视为动态(或准动态)语言的一个关键性质.这个机制同意程序在执行时透过Reflection APIs取得不论什么一个已知名称的class的内部信 ...

  10. Django知识梳理

    请求周期: url > 路由 > 函数或类 > 返回字符串或模板语言 Form 表单提交: 先处理模板语言再讲HTML发出去 提交 > url > 函数或类中的方法  — ...