主要知识点:

  • query phase步骤
  • query phase如何提升性能

 
 

一、query phase步骤

一次query phase一般包括以下三个步骤

 
 

The query phase consists of the following three steps:

  1. The client sends a search request to Node 3, which creates an empty priority queue of size from + size.
  2. Node 3 forwards the search request to a primary or replica copy of every shard in the index. Each shard executes the query locally and adds the results into a local sorted priority queue of size from + size.
  3. Each shard returns the doc IDs and sort values of all the docs in its priority queue to the coordinating node, Node 3, which merges these values into its own priority queue to produce a globally sorted list of results.

 
 

 
 

1、搜索请求发送到某一个coordinate node(node3),构构建一个priority queue,长度以paging操作from和size为准,默认为10

2、coordinate node将请求转发到所有shard,每个shard本地搜索,并构建一个本地的priority queue

3、各个shard将自己的priority queue返回给coordinate node,coordinate node对这些priority queue 进行合并,并构建一个全局的priority queue,然后在这个priority queue得到搜索页的结果。

 
 

二、replica shard如何提升搜索吞吐量

 
 

一次请求要路由所有shard的一个replica或primary上去,如果每个shard都有多个replica,那么同时并发过来的搜索请求可以同时打到其他的replica上去。(也就是说一请求对于一个primary shard及其他对应的所有replica shard 只会有一个shard去处理这一次请求)

 
 

三、延伸阅读

query phase

 
 

 
 

57.query phase的更多相关文章

  1. Elasticsearch的query phase和fetch phase

    对于一次query查询到数据返回到客户端,经历了两个过程  query phase和fetch phase的过程 query phase 查询阶段     fetch phase 获取阶段. 1 qu ...

  2. ElasticSearch7.3学习(二十五)----Doc value、query phase、fetch phase解析

    1.Doc value 搜索的时候,要依靠倒排索引: 排序的时候,需要依靠正排索引,看到每个document的每个field,然后进行排序. 所谓的正排索引,其实就是doc values. 在建立索引 ...

  3. ES--06

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

  4. elasticsearch 基础 语法总结

    1. es 使用 restful 风格的 api 备注: es 的 api  格式  基本是这个样     请求方式    /索引名/文档名/id?参数   ,但是 还有 很多不是这样的 请求,比如 ...

  5. Elasticsearch顶尖高手系列课程推荐

    Elasticsearch,是目前行业中非常热门的一个技术.Elasticsearch是一种分布式的海量数据搜索与分析的技术,可以用于电商网站.门户网站.企业IT系统等各种场景下的搜索引擎,也可以用于 ...

  6. Elasticsearch之深入理解

    @ 目录 ES应用场景 ES应用场景举例 应用场景思考 ES和其他数据库对比 ES架构 Gateway Lucene 数据处理 发现机制与脚本 Transport REST full API ES中集 ...

  7. ElasticSearch 基本介绍和读写搜索过程

    cluster 代表一个集群,集群中有多个节点,其中有一个为主节点,这个主节点是可以通过选举产生的,主从节点是对于集群内部来说的.es的一个概念就是去中心化,字面上理解就是无中心节点,这是对于集群外部 ...

  8. ZOJ 刷题记录 (。・ω・)ノ゙(Progress:31/50)

    [热烈庆祝ZOJ回归] P1002:简单的DFS #include <cstdio> #include <cstring> #include <algorithm> ...

  9. PHP之MVC微型框架简单搭建

    好长时间没有写博客了,这段时间过得紧张的不行,以致于都没有抽出时间来好好的总结一下自己这段时间的生活和学习. 其实今天不想写什么技术博客,就想简单总结一下这段时间的生活.10月8号从家里回来以后决定自 ...

随机推荐

  1. java的死锁学习

    学习java的死锁写的代码 也是看书上的然后自己敲了一个 <span style="font-size:18px;">package synchronization.j ...

  2. ubuntu下eclipse连接mysql

    提示:一定要保证电脑处于联网状态 我们要下载一个mysql-connector-java-5.0.8-bin.jar的东西(当然这个jar包的版本号和你的mysql版本号的关系不是非常大),放到你新建 ...

  3. 菜鸟nginx源代码剖析数据结构篇(六) 哈希表 ngx_hash_t(上)

    菜鸟nginx源代码剖析数据结构篇(六) 哈希表 ngx_hash_t(上) Author:Echo Chen(陈斌) Email:chenb19870707@gmail.com Blog:Blog. ...

  4. Realm Update failed - Android

    Realm Update failed - Android Ask Question up vote 0 down vote favorite I'm using realm for my andro ...

  5. C# 手动编写 DataSet,DataTable 及遍历DataSet中的数据

    一.手动编写DataSet:    有时候不想从数据库导出 DataSet,或者有其他的需要,要将数据库里的DataSet包装成另一个样子,这个时候,了解DataSet的内部结构就非常必要.DataS ...

  6. CodeForces 754D Fedor and coupons&&CodeForces 822C Hacker, pack your bags!

    D. Fedor and coupons time limit per test 4 seconds memory limit per test 256 megabytes input standar ...

  7. Watchcow(欧拉回路)

    http://poj.org/problem?id=2230 题意:给出n个field及m个连接field的边,然后要求遍历每条边仅且2次,求出一条路径来. #include <stdio.h& ...

  8. javascript从作用域链的角度看闭包

    闭包 闭包是一个能访问外部函数定义的变量的函数. 为什么? 当访问一个变量时,解释器会首先在当前作用域查找标示符,如果没有找到,就去父作用域找,直到找到该变量的标示符或者不再存在父作用域了,这就是作用 ...

  9. 深入理解Redis(番外)——持久化

    引语 Redis作为一款内存数据库,自然所有数据都加载在内存中,那么自然就有小伙伴会问,如果服务器宕机了怎么办,数据不都丢了吗,不用担心,Redis早就提供了两种方式来将数据进行持久化,即便服务器宕机 ...

  10. A - Petya and Strings

    Problem description Little Petya loves presents. His mum bought him two strings of the same size for ...