Msearch speed

Hi, we're using elasticsearch 5.3.0 and noticed something weird. Here are my queries using _msearch and _search:

_msearch (/_msearch)

{ "index": "us_import", "type": "shipment", "preference": "_replica_first" }
{ "query": { "match_phrase": { "_all": "manga" } }, "_source": [], "size": 0, "aggregations": { "consignee": { "terms": { "field": "Consignee.Name.untouched" } } } }

_search (/us_import/shipment/_search?preference=_replica_first)

{
    "query": {
        "match_phrase": {
            "_all": "manga"
        }
    },
    "aggs": {
        "consignee_terms": {
            "terms": {
                "field": "Consignee.Name.untouched"
            }
        }
    },
    "_source": [],
    "size": 0
}

As far as I know, these are identical queries. I was experimenting around msearch and tried these two queries, which should have the same running time but was surprised with the results.

The msearch query took around 4 seconds while the search took around 8, which shouldn't be the case since they are supposedly the same query. Is this because of our elasticsearch version or is msearch really supposed to be faster than the normal search. If so, what is the explanation?

Here are the screenshots of the requests and response times, if you need them. I also make sure to reset the cache before doing these queries.

_search

_msearch

Hey,

it is very unlikely that msearch is faster than search - slower might make sense as an msearch with more than one request would need for all requests to finish.

In this case it might be that your query is hitting different shards and thus also different nodes. If those nodes have different loads this might result in this.

You could set the preference parameter, to test this out https://www.elastic.co/guide/en/elasticsearch/reference/6.1/search-request-preference.html

--Alex

Hi Alex, thank you for the reply. We made some changes in the past weeks and I can't seem to replicate my problem. Since the changes are related to data nodes setup, I think your hypothesis is right on the spot.

On another note, our main problem still persists. Perhaps you can shed some light on it? I made a new topic.

Here is the link:

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