ElasticSearch(十五) _search api 分页搜索及deep paging性能问题
1、分页搜索
语法:
size,from GET /_search?size=10
GET /_search?size=10&from=0
GET /_search?size=10&from=20
GET /index/type/_search
{
"query": { "match_all": {} },
"from": 1,
"size": 1
}
实际操作:
查看共有5条数据:
GET /test_index/test_type/_search
"hits" : {
"total" : 7,
"max_score" : 1.0,
我们假设将这7条数据分成3页,每一页是3条数据,来实验一下这个分页搜索的效果
第一页:
GET /test_index/test_type/_search?from=0&size=3 {
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 7,
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_index",
"_type" : "test_type",
"_id" : "10",
"_score" : 1.0,
"_source" : {
"test_field1" : "test1",
"test_field2" : "test2"
}
},
{
"_index" : "test_index",
"_type" : "test_type",
"_id" : "12",
"_score" : 1.0,
"_source" : {
"num" : 1,
"tags" : [ ]
}
},
{
"_index" : "test_index",
"_type" : "test_type",
"_id" : "6",
"_score" : 1.0,
"_source" : {
"test_field" : "test test"
}
}
]
}
}
第二页:
GET /test_index/test_type/_search?from=3&size=3 {
"took" : 7,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 7,
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_index",
"_type" : "test_type",
"_id" : "2",
"_score" : 1.0,
"_source" : {
"test_field" : "replaced test2"
}
},
{
"_index" : "test_index",
"_type" : "test_type",
"_id" : "Baq9WWgBjIP9BXE3vrJ2",
"_score" : 1.0,
"_source" : {
"test_field" : "auto-generate id test"
}
},
{
"_index" : "test_index",
"_type" : "test_type",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"test_field1" : "test1",
"test_field2" : "bulk test1"
}
}
]
}
}
第三页:
GET /test_index/test_type/_search?from=6&size=3 {
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 7,
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_index",
"_type" : "test_type",
"_id" : "11",
"_score" : 1.0,
"_source" : {
"num" : 0,
"tags" : [ ]
}
}
]
}
}
2、深度搜索deep paging的性能问题
ElasticSearch(十五) _search api 分页搜索及deep paging性能问题的更多相关文章
- ElasticSearch(十四) _search api search timeout 机制
语法:timeout=10ms,timeout=1s,timeout=1m GET /_search?timeout=10m timeout:默认无timeout,latency平衡completen ...
- Python 学习 第十五篇:模块搜索路径和包导入
在导入自定义的模块时,除了指定模块名之外,也需要指定目录,由于Python把目录称作包,因此,这类导入被称为包导入.包导入把计算机上的目录变成Python的命名空间,而目录中所包含的子目录和模块文件则 ...
- 十五、API请求接口-远程服务器返回错误: (400) 错误的请求错误
一.远程服务器返回错误: (400) 错误的请求错误 捕获异常查看具体错误 using Newtonsoft.Json; using System; using System.Collections. ...
- 【.NET Core项目实战-统一认证平台】第十五章 网关篇-使用二级缓存提升性能
[.NET Core项目实战-统一认证平台]开篇及目录索引 一.背景 首先说声抱歉,可能是因为假期综合症(其实就是因为懒哈)的原因,已经很长时间没更新博客了,现在也调整的差不多了,准备还是以每周1-2 ...
- 论文阅读笔记二十五:Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition(SPPNet CVPR2014)
论文源址:https://arxiv.org/abs/1406.4729 tensorflow相关代码:https://github.com/peace195/sppnet 摘要 深度卷积网络需要输入 ...
- Elasticsearch由浅入深(七)搜索引擎:_search含义、_multi-index搜索模式、分页搜索以及深分页性能问题、query string search语法以及_all metadata原理
_search含义 _search查询返回结果数据含义分析 GET _search { , "timed_out": false, "_shards": { , ...
- Elasticsearch系列---搜索分页和deep paging问题
概要 本篇从介绍搜索分页为起点,简单阐述分页式数据搜索与原有集中式数据搜索思维方式的差异,就分页问题对deep paging问题的现象进行分析,最后介绍分页式系统top N的案例. 搜索分页语法 El ...
- ES 25 - Elasticsearch的分页查询及其深分页问题 (deep paging)
目录 1 分页查询方法 2 分页查询的deep paging问题 1 分页查询方法 在GET请求中拼接from和size参数 // 查询10条数据, 默认从第0条数据开始 GET book_shop/ ...
- 36.分页及deep paging
主要知识点 1.es分页 2.deep paging 一.es分页语法 size,from 这两个关键字 GET /_search?size=10 指定每页10条数据 GET /_search ...
随机推荐
- CSS3自定义滚动条
webkit支持拥有overflow属性的区域,列表框,下拉菜单,textarea的滚动条自定义样式,不过由于用到了CSS3的属性,兼容性不好 看下滚动条demo:demo1(纯CSS3版) 滚动条的 ...
- VUE之命令行报错:Expected indentation of 4 spaces but found 6
使用vue时候,经常被一大片警告惊呆了,这是webpack默认的语法检查插件ESLint在做警告, [ESLint是一个语法规则和代码风格的检查工具,可以用来保证写出语法正确.风格统一的代码] 但是我 ...
- Codeforces Gym101502 H.Eyad and Math-换底公式
H. Eyad and Math time limit per test 2.0 s memory limit per test 256 MB input standard input outpu ...
- 东方14ACM小组 15:Challenge 11
Challenge 11 查看 提交 统计 提问 总时间限制: 10000ms 单个测试点时间限制: 1000ms 内存限制: 262144kB 描述 给一个长为N的数列,有M次操作,每次操作是 ...
- JDK1.8和Spring 3.2.0 的坑
上午 org.apache.catalina.core.StandardContext listenerStart严重: Exception sending context initialized e ...
- 使用UltraISO为U盘或内存卡制作系统安装工具
此软件可以为U盘制作Windows安装版的启动工具,也可以为Linux制作启动工具,尤其是Ubuntu这些.提示:推荐购买一些读取速度快一些的U盘,运行起来可以节省很多时间. 如果是内存卡要实现此功能 ...
- 【spring mvc】后台的API,测试中,总提示接口实体的某一个字段不能为null,但是明明给值了还提示不能为空
实体是这三个字段 接口的实现类Controller 前台测试给值 依旧报错 解决方法: 需要添加@RequestBody注解
- mac下mysqldump找不到命令
之所以会出现MySQL或者mysqldump这样的命令找不到, 我们可以打开/usr/bin文件夹,发现bin目录中并没有mysql打头的UEF文件, 而在/usr/local/mysql/bin中可 ...
- linux下添加自动启动项,linux 开机自动启动脚本方法
#service servicename status是当前状态#chkconfig --list servicename是查看启动状态,也就是是否开机自动启动 首先写好脚本,如 mysql,把它放到 ...
- 第七讲_图像描述(图说)Image Captioning
第七讲_图像描述(图说)Image Captioning 本章结构 递归神经网络 时序后向传播(BPTT) 朴素Vanilla-RNN 基本模型 用sigmoid存在严重的梯度消失 LSTM长短时记忆 ...