### 多文档模式 The patterns for the `mget` and `bulk` APIs are similar to those forindividual documents. The difference is that the requesting node knows inwhich shard each document lives. It breaks up the multi-document request intoa multi-document request _per shard_, and forwards these in parallel to eachparticipating node. Once it receives answers from each node, it collates their responsesinto a single response, which it returns to the client. [[img-distrib-mget]].Retrieving multiple documents with `mget`image::images/04-05_mget.png["Retrieving multiple documents with mget"] Below we list the sequence of steps necessary to retrieve multiple documentswith a single `mget` request, as depicted in <>: 1. The client sends an `mget` request to `Node_1`. 1. `Node 1` builds a multi-get request per shard, and forwards theserequests in parallel to the nodes hosting each required primary or replicashard. Once all replies have been received, `Node 1` builds the responseand returns it to the client. A `routing` parameter can be set for each document in the `docs` array,and the `preference` parameter can be set for the top-level `mget`request. [[img-distrib-bulk]].Multiple document changes with `bulk`image::images/04-06_bulk.png["Multiple document changes with bulk"] Below we list the sequence of steps necessary to execute multiple`create`, `index`, `delete` and `update` requests within a single`bulk` request, as depicted in <>: 1. The client sends a `bulk` request to `Node_1`. 1. `Node 1` builds a bulk request per shard, and forwards these requests in parallel to the nodes hosting each involved primary shard. 1. The primary shard executes each action serially, one after another. As eachaction succeeds, the primary forwards the new document (or deletion) to itsreplica shards in parallel, then moves on to the next action. Once allreplica shards report success for all actions, the node reports success tothe requesting node, which collates the responses and returns them to theclient. The `bulk` API also accepts the `replication` and `consistency` parametersat the top-level for the whole `bulk` request, and the `routing` parameterin the metadata for each request.