To answer this, we need to explain a little background:
If the individual requests were wrapped up in a JSON array, that would mean
that we would need to:
- parse the JSON into an array (including the document data, which
can be very large) - create an array of requests for each shard
- send the requests to each shard
Instead, Elasticsearch reaches up into the networking buffer, where the raw
request has been received and reads the data directly. It uses the newline
characters to identify and parse just the small action/metadata lines in
order to decide which shard should handle each request.