elasticsearch 权威指南排序阅读笔记(六)
默认排序
默认查询是通过_source 准确性权重来排序
字段排序
{
"query":{
"match":{
"productName":"床垫"
}
},
"sort":{
"price":"desc"
}
}
结果
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 11,
"max_score": null,
"hits": [
{
"_index": "blogs2",
"_type": "product",
"_id": "1",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8",
"price": 13,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
13
]
},
{
"_index": "blogs2",
"_type": "product",
"_id": "2",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8",
"price": 12,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
12
]
},
{
"_index": "blogs2",
"_type": "product",
"_id": "14",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8 14",
"price": 10,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
10
]
},
{
"_index": "blogs2",
"_type": "product",
"_id": "8",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8 8",
"price": 10,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
10
]
},
{
"_index": "blogs2",
"_type": "product",
"_id": "9",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8 9",
"price": 10,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
10
]
},
{
"_index": "blogs2",
"_type": "product",
"_id": "10",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8 10",
"price": 10,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
10
]
},
{
"_index": "blogs2",
"_type": "product",
"_id": "12",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8 12",
"price": 10,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
10
]
},
{
"_index": "blogs2",
"_type": "product",
"_id": "6",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8 6",
"price": 10,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
10
]
},
{
"_index": "blogs2",
"_type": "product",
"_id": "7",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8 7",
"price": 10,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
10
]
},
{
"_index": "blogs2",
"_type": "product",
"_id": "13",
"_score": null,
"_source": {
"productName": "法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8 13",
"price": 10,
"remark": "不错的床垫",
"tags": [
"家具",
"床垫",
"棉花"
]
},
"sort": [
10
]
}
]
}
}
可以发现_score为null并没有计算 因为计算是会消耗性能的 需要强制打开可以设置track_score为true
多级排序
{
"query": {
"match": {
"productName": "床垫"
}
},
"sort": [{
"price": "desc"
}, {
"count": "asc"
}]
}
Url搜索排序
elasticsearch 权威指南排序阅读笔记(六)的更多相关文章
- elasticsearch 权威指南聚合阅读笔记(七)
count(1) select clssId,count(1) from student group by classId { "size":0, "aggs" ...
- elasticsearch 权威指南入门阅读笔记(一)
相关文档 esapi:https://es.xiaoleilu.com/010_Intro/10_Installing_ES.html https://esdoc.bbossgroups.co ...
- 《Elasticsearch 权威指南》阅读笔记
书籍地址 https://www.elastic.co/guide/cn/elasticsearch/guide/current/languages.html
- elasticsearch 权威指南搜索阅读笔记(四)
多索引多type搜索 分页搜索 每页5条 查询一到3页数据 第一页:http://127.0.0.1:9200/blogs2/product/_search?size=5&from=0 第二页 ...
- 《javascript权威指南》阅读笔记 1
3.1-3.5 3.1 数字 3.1首先声明了在JS中的数字是不区分整数值和浮点数值的.其次给出了js浮点类型表示的范围:最大值是±1.7976931348623157×10^308,最小值±5×10 ...
- 《HTTP权威指南》--阅读笔记(二)
URL的三部分: 1,方案 scheme 2,服务器位置 3,资源路径 URL语法: <scheme>://<user>:<password>@<host&g ...
- 《HTTP权威指南》--阅读笔记(一)
HTTP: HyperText Transfer Protocol 测试站点:http://www.joes-hardware.com URI包括URL和URN URI: Uniform Resour ...
- 《javascript权威指南》读书笔记——第一篇
<javascript权威指南>读书笔记——第一篇 金刚 javascript js javascript权威指南 由于最近想系统学习下javascript,所以开始在kindle上看这本 ...
- Elasticsearch权威指南(中文版)
Elasticsearch权威指南(中文版) 下载地址: https://pan.baidu.com/s/1bUGJmwS2Gp0B32xUyXxCIw 扫码下面二维码关注公众号回复100010 获取 ...
随机推荐
- luogu1273 有限电视网
题目大意 有一棵有根树,每个结点有一个收益,每条边有一个花费.如果要选择一个叶子结点,则根节点到该叶子结点的路径上的所有结点都必须被选择.求当总收益大于等于总花费的情况下,最多能选择多少个叶子结点. ...
- oc48--多个对象内存管理练习
// // main.m // 多个对象内存管理练习 // // ARC是Xcode帮我们生成内存释放的代码,MRC是需要我买自己写retain和release.想研究内存管理只能在MRC,管理对象就 ...
- bzoj5441: [Ceoi2018]Cloud computing
跟着大佬做题.. 这题也是有够神仙了.观察一下性质,c很小而f是一个限制条件(然而我并不会心态爆炸) %了一发,就是把电脑和订单一起做背包,订单的c视为负而电脑的v为负,f由大到小排序做背包 #inc ...
- Base Class Doesn't Contain Parameterless Constructor?
http://stackoverflow.com/questions/7689742/base-class-doesnt-contain-parameterless-constructor #regi ...
- springboot 异常: Requested bean is currently in creation: Is there an unresolvable circular reference?
2018-07-31 11:56:18.812 WARN 10316 --- [ main] ConfigServletWebServerApplicationContext : Exception ...
- Codeforces--621B--Wet Shark and Bishops(数学)
B. Wet Shark and Bishops time limit per test 2 seconds memory limit per test 256 megabytes input ...
- 洛谷P3809 后缀数组模板
题目:https://www.luogu.org/problemnew/show/P3809 刚学了后缀数组,看人家手写演示了半天,大概明白了过程,但完全写不出来代码: 于是借鉴了许多,不过都差不多, ...
- C++_homework_EraseComment
顾名思义就是删除程序中的注释,不清楚fsm的机制,完全是自己的思路做. 开头先读取一个字符确定是否到文件结尾,如果读取成功,是换行的话就换行,并继续读取,不是的话,用putback放回缓冲区,并整行读 ...
- 基于Angular4+ server render(服务端渲染)开发教程
目标: 1.更好的 SEO,方便搜索爬虫抓取页面内容 2.更快的内容到达时间(time-to-content) 影响: 1.用户:比原来更快的看到渲染的页面,提升用户体验 2.开发人员:某些代码可能需 ...
- Spring + Redis ( 简单使用)
1.Redis 的 Java API Java 中 使用 Redis 工具,要先去 maven 仓库中,下载 jedis jar包 jedis 依赖 <dependency> <gr ...