我们之前查询出的结果都会有一个_score分值表示列出结果与搜索结果的相关性,该值越高排序位置越靠前,es具体是如何计算该值的,我们认真来看看. 1.根据字段值排序 比如我们要查询/index5下subject.subject-name匹配关键字"computer"的内容,并且根据subject.id字段做倒序排序 其实这个查询相当于关系型数据库查询:select * from index5 where subject.subject-name like '%computer%' or…
前面大概了解了一下elasticsearch的数据存储和数据的查询.现在学习一下,es的复杂操作. 官网相关文档地址:https://www.elastic.co/guide/en/elasticsearch/client/java-api/7.x/java-docs-delete-by-query.html spring boot提供的Elasticsearch 的Data查询:https://docs.spring.io/spring-data/elasticsear…
使用function_score进行分组处理,利用分组函数script_score进行自定义分值处理, 注意:使用script功能需要在配置中打开脚本功能: script.inline: on script.indexed: on script.engine.groovy.inline.aggs: on script.file: on 下图中的查询表示,查询termid为1238218的记录,或者displayname包含“宝宝”的记录: termid为1238218的记录排序分人为设…
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 _s…