1、fetch phbase工作流程

  1. The coordinating node identifies which documents need to be fetched and issues a multi GETrequest to the relevant shards.
  2. Each shard loads the documents and enriches them, if required, and then returns the documents to the coordinating node.
  3. Once all documents have been fetched, the coordinating node returns the results to the client.

The coordinating node first decides which documents actually need to be fetched. For instance, if our query specified { "from": 90, "size": 10 }, the first 90 results would be discarded and only the next 10 results would need to be retrieved. These documents may come from one, some, or all of the shards involved in the original search request.

The coordinating node builds a multi-get request for each shard that holds a pertinent document and sends the request to the same shard copy that handled the query phase.

The shard loads the document bodies—the _source field—and, if requested, enriches the results with metadata and search snippet highlighting. Once the coordinating node receives all results, it assembles them into a single response that it returns to the client.

 
 

(1)各个shard 返回的只是各文档的id和排序值( IDs and sort values ,coordinate node根据这些id&sort values 构建完priority queue之后,然后把程序需要的document 的id发送mget请求去所有shard上获取对应的document

(2)各个shard将document返回给coordinate node

(3)coordinate node将合并后的document结果返回给client客户端

 
 

2、一般搜索,如果不加from和size,就默认搜索前10条,按照_score排序

 
 

延伸阅读

Deep Pagination

The query-then-fetch process supports pagination with the from and size parameters, but within limits. Remember that each shard must build a priority queue of length from + size, all of which need to be passed back to the coordinating node. And the coordinating node needs to sort through number_of_shards * (from + size) documents in order to find the correct size documents.

Depending on the size of your documents, the number of shards, and the hardware you are using, paging 10,000 to 50,000 results (1,000 to 5,000 pages) deep should be perfectly doable. But with big-enough from values, the sorting process can become very heavy indeed, using vast amounts of CPU, memory, and bandwidth. For this reason, we strongly advise against deep paging.

In practice, "deep pagers" are seldom human anyway. A human will stop paging after two or three pages and will change the search criteria. The culprits are usually bots or web spiders that tirelessly keep fetching page after page until your servers crumble at the knees.

If you do need to fetch large numbers of docs from your cluster, you can do so efficiently by disabling sorting with the scroll query, which we discuss later in this chapter.

 
 

 
 

 
 

58.fetch phbase的更多相关文章

  1. ES--06

    第51.初识搜索引擎_上机动手实战多搜索条件组合查询 课程大纲 GET /website/article/_search{ "query": { "bool": ...

  2. Swift - 后台获取数据(Background Fetch)的实现

    前面讲了如何让程序申请后台短时运行.但这个额外延长的时间毕竟有限.所以从iOS7起又引入两种在后台运行任务的方式:后台获取和后台通知. 1,后台获取介绍 后台获取(Background Fetch)是 ...

  3. FW: How to use Hibernate Lazy Fetch and Eager Fetch Type – Spring Boot + MySQL

    原帖 https://grokonez.com/hibernate/use-hibernate-lazy-fetch-eager-fetch-type-spring-boot-mysql In the ...

  4. python 读写西门子PLC 包含S7协议和Fetch/Write协议,s7支持200smart,300PLC,1200PLC,1500PLC

    本文将使用一个gitHub开源的组件技术来读写西门子plc数据,使用的是基于以太网的TCP/IP实现,不需要额外的组件,读取操作只要放到后台线程就不会卡死线程,本组件支持超级方便的高性能读写操作 nu ...

  5. kafka启动失败错误:: replica.fetch.max.bytes should be equal or greater than message.max.bytes

    1 详细异常 2019-10-14 14:38:21,260 FATAL kafka.Kafka$: java.lang.IllegalArgumentException: requirement f ...

  6. Git 少用 Pull 多用 Fetch 和 Merge

    本文有点长而且有点乱,但就像Mark Twain Blaise Pascal的笑话里说的那样:我没有时间让它更短些.在Git的邮件列表里有很多关于本文的讨论,我会尽量把其中相关的观点列在下面. 我最常 ...

  7. git提示:Fatal:could not fetch refs from ....

    在git服务器上新建项目提示: Fatal:could not fetch refs from git..... 百度搜索毫无头绪,最后FQgoogle,找到这篇文章http://www.voidcn ...

  8. sublime 插件推荐: Nettuts+ Fetch

    Nettuts+ Fetch github地址:Nettuts-Fetch 在sublime中直接用 ctrl+shift+P -> pci -> Nettuts-Fetch 即可下载 这 ...

  9. git pull和git fetch的区别

    Git中从远程的分支获取最新的版本到本地有这样2个命令:1. git fetch:相当于是从远程获取最新版本到本地,不会自动merge Git fetch origin master git log ...

随机推荐

  1. Light oj 1138 - Trailing Zeroes (III) 【二分查找 && N!中末尾连续0的个数】

    1138 - Trailing Zeroes (III) problem=1138"> problem=1138&language=english&type=pdf&q ...

  2. Ural 1353 Milliard Vasya's Function(DP)

    题目地址:Ural 1353 定义dp[i][j].表示当前位数为i位时,各位数和为j的个数. 对于第i位数来说.总能够看成在前i-1位后面加上一个0~9.所以状态转移方程就非常easy出来了: dp ...

  3. Git项目删除文件

    场景:项目中有一个文件test_exam_copy 文件之前提交上去的,现在不想要,本地也不要 方案一(手动图示删除): 直接登录到gitLab上面,进入该文件详情,直接删除,然后本机push下,则库 ...

  4. vbs setkeys 特殊符号

    set keys={~}!^@^#^${%%}{^&^}{^^}{*}{(}{)}{_}{-}{=}{+}.;:'"

  5. 好记性不如烂笔头——DML/DDL/DCL/TCL,OLTP/OLAP

    DML:数据操作语言,就是增删改之类的语句 DDL:数据定义语言,创建.修改.删除表等 ALTER 语句 (Transact-SQL) CREATE 语句 (Transact-SQL) DISABLE ...

  6. THRDTERM-----干净地结束一个线程

    THRDTERM产生两个线程.周期性地检查一个event对象.以决定要不要结束自己. #define WIN32_LEAN_AND_MEAN #include<stdio.h> #incl ...

  7. bzoj2120 数颜色——带修莫队

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2120 带修改的莫队: 用结构体存下修改和询问,排好序保证时间后就全局移动修改即可: 参考了T ...

  8. js定义类和方法

    js中定义一个类 //定义一个user类 var user = function(){ //类中的属性 var age; //设置age的值 var setAge = function(age){ t ...

  9. CodeForces A. Meeting of Old Friends

    2019-05-30 20:19:57 加油!!! sort(a + 1, a + 5); 卡了一会儿 #include <bits/stdc++.h> using namespace s ...

  10. ScreenRecord(about C# winform)

    由于一些不得不做的事(哈,有时间再聊),所以就不得不写一个关于录屏的软件了,如此无力的开篇,开始吧. 在网上搜了很多关于录屏的源码,发现都使不了,剧情的需要很难满足.于是突然想到了github上的一个 ...