How elasticsearch deals with the result of each shard?

Hi Elasticians!

I was thinking in how Elasticsearch deals with the results from each shard and how it can lead to imprecise results, once each shard only knows about its data (I also read we can make it work precisely)

And all of a sudden I came to the conclusion that I didn't had any idea about where is the data gathered and processed to return a single answer to the client.

is it the master node that does this work? is it the data node? if yes which data node does this job? other?

Thank you for the help

I found out the answer :slight_smile:

Every node is a coordinator node.
the coordination happens in two phases:

scatter
the request is sent to the nodes
and

gather
the replies are sent back to the coordinator and reduced to a single answer.

more in:
elastic.co