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. android TextView 设置字体大小

    package com.example.yanlei.yl4; import android.graphics.Color;import android.os.Bundle;import androi ...

  2. iOS 推送 获取手机设备的 deviceToken

    第一步:申请证书: 第二步:申请app ids,应用名字必须一致.然后再进入进行编辑.使其enable,绿灯. 第三步:申请provisioning profile,生成.mobileprovisio ...

  3. Eclipse出现"Running Android Lint has encountered a problem"解决方式

    近期打开Eclipse的时候,总是发生这种一个错误:"Running Android Lint has encountered a problem".截图例如以下: . 可是Ecl ...

  4. android相关文件夹的存取方式与函数解析---全

    因为排版问题.转为markdown编辑: http://blog.csdn.net/self_study/article/details/58587412

  5. mysql: expire_logs_days设置后无效问题

    Sina blog - MySQL的 expire_logs_days 和 PURGE MASTER LOGS 无效问题

  6. MySQL-获取某天的数据

    今天 select * from 表名 where to_days(时间字段名) = to_days(now()); 昨天 近7天 DAY) <= date(时间字段名) 近30天 DAY) & ...

  7. css实现轮播效果图

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. angular.js 入门

    1.安装nodejs 首先要安装nodejs,如果你的电脑已经装过了,最好确认是比较新的版本,否则可能会出问题. 没有安装的直接去nodejs官网下载nodejs安装.安装过程很简单,官网有教程. 安 ...

  9. docker--caffe

    Running an official image You can run one of the automatic builds. E.g. for the CPU version: docker ...

  10. 后端程序员看前端想死(三)是不是该学点js了

    CSS盒子模型 div布局 js 这些都懂一点,但仅仅是懂一点,有时间就学一下咯