ElasticSearch scroll & scan usage

It's very useful to retrieve massive data, instead of the deep pagination.

Deep pagination with from
and size
 — e.g. ?size=10&from=10000
 — is very inefficient as (in this example) 100,000 sorted results have to be retrieved from each shard and resorted in order to return just 10 results. This process has to be repeated for every page requested.

Initial query :

   curl -XGET 'localhost:9200/twitter/tweet/_search?scroll=1m' -d '{ "query": { "match" : { "title" : "elasticsearch" } }}'

The result from the above request includes a _scroll_id, which should be passed to the scroll
API in order to retrieve the next batch of results.

curl -XGET 'localhost:9200/_search/scroll?scroll=1m' -d 'c2Nhbjs2OzM0NDg1ODpzRlBLc0FXNlNyNm5JWUc1'

Reference here

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 昨天是回北京第一天,仅仅一天,就发生了很多事情。也许是我初入社会,一件小事,一个小问题就足以让人崩溃。本以为自己很...
    姜格拉底阅读 460评论 0 0
  • 洗头发会心跳加快,pa不舒服 剪头发会心跳加快,pa不好看 下城和朋友碰面,会心跳加快,pa衣服不好看 开学会心跳...
    chde我阅读 121评论 0 0
  • 7/100 #100天坚持一件事# 早间要事: 1.5:30起床 2.练习气泡音,口唇舌,腰部力量。 3.读《圣经...
    zuimeideni阅读 156评论 0 0