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. Ubuntu 16.04中的Dock的应用顺序调整

    操作步骤: 参考: https://askubuntu.com/questions/39805/is-there-an-easy-way-to-rearrange-or-move-the-icons- ...

  2. SpringMVC中 Controller的 @ResponseBody注解分析

    需求分析:需要 利用    out 对象返回给财付通是否接收成功 .那么将需要如下代码: /** * 返回处理结果给财付通服务器. * @param msg: Success or fail. * @ ...

  3. PopupMenu和对话框的使用

    PopupMenu和对话框的使用 1.菜单的使用之 PopupMenu 步骤:1.创建popupMenu对象 参数:上下文对象   当前view对象 2.利用getMenu().addSubMenu创 ...

  4. Go -- LFU类(缓存淘汰算法)(转)

    1. LFU类 1.1. LFU 1.1.1. 原理 LFU(Least Frequently Used)算法根据数据的历史访问频率来淘汰数据,其核心思想是“如果数据过去被访问多次,那么将来被访问的频 ...

  5. scrapy 启动失败,scrapy startproject test 出错 'module' object has no attribute 'OP_NO_TLSv1_1

    你先看看 pip install scrapy需要的 pyopenssl  twisted  等和你安装的版本一样么  我的就是因为TWist 版本高于  需要的 用pip install twist ...

  6. 在Intellij上面导入项目 & AOP示例项目 & AspectJ学习 & Spring AoP学习

    为了学习这篇文章里面下载的代码:http://www.cnblogs.com/charlesblc/p/6083687.html 需要用Intellij导入一个已有工程.源文件原始内容也可见:link ...

  7. Python3.2官方文档翻译--作用域和命名空间实例

    6.2.1 作用域和命名空间实例 以下的实例主要用来示范怎样引用不同的作用域和命名空间,keywordglobal和nonlocalru怎样影响变量绑定. 实例执行结果是: After local a ...

  8. serialVersionUID的作用以及如何用idea自动生成实体类的serialVersionUID

    转载:http://blog.csdn.net/liuzongl2012/article/details/45168585 serialVersionUID的作用: 通过判断实体类的serialVer ...

  9. 手把手教你安装Hbase,一次成功!

    安装环境: OS: Centos 6.5 JDK: jdk1.6.0_18 Hadoop: hadoop-0.20.2 Hbase: hbase-0.90.5 安装准备: 1.       Jdk环境 ...

  10. openpyxl的使用记录

    脚本功能描述: 读取指定文件夹内的.xlsx文件,遍历提取整理信息保存到另一指定文件夹中 import openpyxl import os import shutil city='城市名' def ...