# Is there an msearch performance gain if all queries are targeting the same field?

**URL:** <https://discuss.elastic.co/t/is-there-an-msearch-performance-gain-if-all-queries-are-targeting-the-same-field/235296>\
**Category:** Elasticsearch\
**Created:** [June 2, 2020, 8:46am UTC](https://discuss.elastic.co/t/is-there-an-msearch-performance-gain-if-all-queries-are-targeting-the-same-field/235296 "2020-06-02T08:46:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndtreviv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ndtreviv/32/22494_2.png) [@ndtreviv](https://discuss.elastic.co/u/ndtreviv)\
**Post date:** [June 2, 2020, 8:46am UTC](https://discuss.elastic.co/t/is-there-an-msearch-performance-gain-if-all-queries-are-targeting-the-same-field/235296/1 "2020-06-02T08:46:34Z")

</div>

I'm trying to query elastic with lots and lots of queries. I'm batching the queries into set-sized msearches according to our query queue settings.

At the moment it's organised so that each msearch only contains queries for the same fields. For example, one msearch contains 100 queries where all of the queries are targeting the same term field (in this case: md5).

Is there actually a benefit to doing it this way (ie: targeting one field for all queries in an msearch), or is it imagined?  
I'm re-writing this component to be more efficient with msearch query-packing, and it would be easier if I didn't have to group queries targeting the same field into msearches.

---

<div class="post-metadata">

**Author:** ![ndtreviv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ndtreviv/32/22494_2.png) [@ndtreviv](https://discuss.elastic.co/u/ndtreviv)\
**Post date:** [June 5, 2020, 11:08am UTC](https://discuss.elastic.co/t/is-there-an-msearch-performance-gain-if-all-queries-are-targeting-the-same-field/235296/2 "2020-06-05T11:08:56Z")

</div>

Surely someone with knowledge of the internal workings of ES must know this?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 3, 2020, 11:09am UTC](https://discuss.elastic.co/t/is-there-an-msearch-performance-gain-if-all-queries-are-targeting-the-same-field/235296/3 "2020-07-03T11:09:01Z")

</div>

Closed on July 3, 2020, 11:09am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
