[Elasticsearch] Document query principle

Insert picture description here

1 Overview

2. Principle of query request

  1. First, the client selects any node and sends a request g et document id=1, P1
  2. When sent to node1, node1 is the coordinate node, and the coordinate node routes the document. After routing, you know which primary shard it is on.
  3. The previous process is the same as adding, deleting and modifying, but the latter is a bit different. After the coordinate node knows which primary shard it is on, it may not be sent directly to the corresponding primary shard, but can also be sent to the replica shard.
  4. The coordinate node adopts a round-robin random training algorithm. Let alone coordinate node, after receiving 4 queries for a document, it will use the algorithm to forward 2 query requests to P1 and 2 requests to R1. Let the primary shard and all the replica shards evenly serve the read requests to obtain the effect of load balancing.

Guess you like

Origin blog.csdn.net/qq_21383435/article/details/108908127