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 ...
随机推荐
- es6 export、import
一.输出变量 1.export var a = 0; 2.var a = 0'; export {a}; 3.var a =0 ; export {a as rename}; //使用as重命名的对外 ...
- Network | Public-key cryptography
公开密钥加密public-key cryptography,也称为非对称(密钥)加密. 非对称密钥,是指一对加密密钥与解密密钥,这两个密钥是数学相关,用某用户密钥加密后所得的信息,只能用该用户的解密密 ...
- FMDB使用的数据库的三种形式
FMDB使用的数据库的三种形式 FMDB是iOS平台下一款优秀的第三方SQLite数据库框架.它以Objective-C的方式封装了SQLite的C语言API.使用起来,它更加面向对象,避免冗余的 ...
- 深刻理解JavaScript---闭包
JavaScript 闭包是指那些能够访问独立(自由)变量的函数 (变量在本地使用,但定义在一个封闭的作用域中).换句话说,这些函数可以“记忆”它被创建时候的环境.——这句话其实有点难以理解.我觉 ...
- 如何提高NodeJS程序的运行的稳定性
如何提高NodeJS程序运行的稳定性 我们常通过node app.js方式运行nodejs程序,但总有一些异常或错误导致程序运行停止退出.如何保证node程序的稳定运行? 下面是一些可以考虑的方案: ...
- margin: 0 auto; 元素水平居中布局无效
失效原因: 要给居中的元素一个宽度,否则无效. 该元素一定不能浮动或绝对定位,否则无效. 在HTML中使用<center></center>标签,需考虑好整体构架,否者全部元素 ...
- 在pypy环境中运行odoo8
PyPy是一个独立的解析器, 通过即时编译(JIT,Just-in-time)代码避免逐行解释执行来提升运行速度的(将编译过的行代码缓存起来,从而加快速度).我们一般使用的Python一般是使用C实现 ...
- Codeforces Round #277 (Div. 2)D(树形DP计数类)
D. Valid Sets time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- 使用 Navicat 8.0 管理mysql数据库(导出导入数据)
http://dxcns.blog.51cto.com/1426423/367105 使用Navicat For MySql 将mysql中的数据导出,包括数据库表创建脚本和数据 (1)数据的导出:右 ...
- CrtmpServr 接收Http流程
最近在研究CrtmpServer http部分,记录一些基本的流程,以备查阅. 首先,打开配置脚本CrtmpServer.lua ,确认脚本中有以下内容,如果没有需要加上. { name=" ...