4

_msearch is used for multiple searches in one go. This alone is a performance improvement since it reduces the network overhead. Right now I'm using _msearch like the _search endpoint, for single queries. I wanted to have this mechanism in place for future batch processing. Until I take advantage of the batch processing will this introduce an overhead? Does _msearch behave exactly the same as _search for single queries?

Nkosi
  • 235,767
  • 35
  • 427
  • 472
Alkis Kalogeris
  • 17,044
  • 15
  • 59
  • 113

2 Answers2

6

There's a very small overhead in the sense that even if you have one query, the _msearch endpoint will still need to iterate over it and create a single search query.

However, I would consider this overhead as clearly negligible.

Val
  • 207,596
  • 13
  • 358
  • 360
  • Yes I agree. I was afraid of something like elasticsearch doing something clever with the queries in order to boost the overall performance. Something like smart caching of some sort, in order to take advantage of the 1st query's results for the 2nd one, etc (if they are one the same index of course). – Alkis Kalogeris Oct 12 '16 at 05:22
  • 1
    Any query **might** benefit from what was cached when processing the other queries. The normal search infrastructure is leveraged for the multi-search endpoint, too, but multi-search is merely a way to shrink-wrap multiple queries in one go, much the same way as bulk queries can wrap multiple index queries – Val Oct 12 '16 at 05:30
  • Thanks for the followup. Upvoted and marked. Have fun – Alkis Kalogeris Oct 12 '16 at 06:11
0

_msearch is multi search it takes a little over head than the _search because The multi search API allows to execute several search requests within the same API.