Elastic Search - IS “Fetch” phase really needed during seach

Viewed 459

This question always comes up during discussions and there is "no" strong answer to say

Is "Fetch" phase really needed during search - As we understand , the coordinating node executes the search in two phases - "Query" - "Then"

One of the reasoning was - From documentation - Why the whole information cant be sent to coordinating node and only just enough information? If whole information i sent, coordinating can merge shard level results and send the documents back to client by NOT performing "Fetch operation" ? Is it for pagination , or is it to save some bandwidth ?

The request is processed in two phases. In the first phase, the query is forwarded to all involved shards . Each shard executes the search and generates a sorted list of results, local to that shard. Each shard returns just enough information to the coordinating node to allow it to merge and re-sort the shard level results into a globally sorted set of results, of maximum length size .

1 Answers

It would definitely be a waste of bandwidth!

Fetching is not always necessary, for instance, when running aggregations it is recommended to set the size to 0, especially to avoid the fetch phase as it is not required to return all document fields when all you want to get back are aggregation results.

I'm curious to know, though, why you are so worried about this fetch phase?

Related