_msearch vs _search

There's no real "prioritization" of search requests in ES, they are simply handled as soon as they are received. So the main difference between the two is that the single-search scenario will have a bit more network overhead due to initiating a new connection for each search, while the connection cost is amortized over the full MSearch request.

There will also be a bit more memory overhead in the MSearch, as the coordinating node will have to accumulate the various search responses in memory before sending back the final response.

Lastly, MSearch could potentially have a higher latency. It has to wait for all search requests to finish before sending back the final response, so if one of the searches is particularly slow (expensive query, nodes involved are slow, etc), the whole MSearch will block while that query finishes. In contrast, individual search requests will return as soon as they finish so they may have a lower individual latency (except for the slow query, obviously).

Internally, the actual execution of the searches is basically identical, so nothing different there. MSearch is internally dispatched as a bunch of single searches to the relevant nodes.

1 Like