# Is there a limit for the msearch?

**URL:** https://discuss.elastic.co/t/is-there-a-limit-for-the-msearch/245361
**Category:** Elasticsearch
**Created:** [August 18, 2020, 6:51am UTC](https://discuss.elastic.co/t/is-there-a-limit-for-the-msearch/245361 "2020-08-18T06:51:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![richylyq](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@richylyq](https://discuss.elastic.co/u/richylyq)
#### Post date: [August 18, 2020, 6:51am UTC](https://discuss.elastic.co/t/is-there-a-limit-for-the-msearch/245361/1 "2020-08-18T06:51:45Z")

</div>

i tried getting results from `elastic_client.search` and `elastic_client.msearch` and both returns different amount of results. and `elastic_client.search` returns the most accurate result

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [August 18, 2020, 6:53am UTC](https://discuss.elastic.co/t/is-there-a-limit-for-the-msearch/245361/2 "2020-08-18T06:53:52Z")

</div>

Your question lacks a fair bit of context unfortunately.

What version of Elasticsearch? What sort of queries are you running? What are the results you are seeing? What are you expecting? Please provide code, logs, responses etc.

---

<div class="post-metadata">

### Author: ![richylyq](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@richylyq](https://discuss.elastic.co/u/richylyq)
#### Post date: [August 18, 2020, 7:12am UTC](https://discuss.elastic.co/t/is-there-a-limit-for-the-msearch/245361/3 "2020-08-18T07:12:02Z")

</div>

based on these two sets of queries

```auto
def queryNCRate(unit_type):                                                       

    wyList = []
    ncList = []
    ncHits = []
    rateList = []

    # create request
    request = []

    for wy, nc in product(wy_request, nc_request):
        head = { 'index' : ES_INDEX }
        body = {
            'query': {
                'bool': {
                    'must': [
                        { 'match_phrase' : { 'text' : nc} },
                        { 'match_phrase' : { 'workyear' : wy} },
                        { 'match_phrase' : { 'unit_type' : unit_type} }
                    ]
                }
            }
        }

        request.extend([head, body])
    # print(request)
    # search through defined index with the query for nc for particular workyear
    nc_result = elastic_client.msearch(body=request)
    # print(nc_result)

    # returns amount of defined ncs for particular workyear
    nc_hits = len(nc_result["responses"][18]["hits"]["hits"])
    
    print(nc_hits)

```

and this

```auto
st = []
    ncList = []
    ncHits = []
    rateList = []

    for wy, nc in product(wy_request, nc_request):
            
        query_nc = {
            "query" : {
                "bool" : { 
                    "must" : [
                        { 
                            "match_phrase": { 
                                "text": nc
                            } 
                        },
                        { 
                            "match_phrase": {
                                "workyear": wy
                            }
                        },
                        {
                            "match_phrase": {
                                "unit_type": unit_type
                            }
                        }
                    ]
                }
            }
        }
        nc_result = elastic_client.search(index="test-index", body=query_nc, size=999) # searching thru the defined index with the query for NC for particular workyear
        # print(nc_result["hits"]["hits"])
        nc_hits = len(nc_result["hits"]["hits"]) # returns the amount of defined NCs for the particular workyear
        print(nc_hits)
        
        wyList.append(wy)
        ncList.append(nc[16:])
        ncHits.append(nc_hits)

        if (wyrsafDict.get(wy) != 0 ):
            nc_rate = nc_hits / wyrsafDict.get(wy) # deriving the NC Rate
        else:
            nc_rate = 0
        # print("NCRate: ", nc_rate)
        rateList.append(nc_rate)

```

with the second query using `elastic_client.search`, i got 22 hits, which i doubled checked and confirmed that is the correct amount, but when i used `elastic_client.msearch`, i somehow gotten only 10 hits  
and like those that i am supposed to get more than 10 hits, resulted in maximum of 10 hits

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [August 18, 2020, 7:45am UTC](https://discuss.elastic.co/t/is-there-a-limit-for-the-msearch/245361/4 "2020-08-18T07:45:26Z")

</div>

For the search request you specify a size greater than 10. As this is not specified for the msearch you get the default 10 results.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [August 18, 2020, 8:11am UTC](https://discuss.elastic.co/t/is-there-a-limit-for-the-msearch/245361/6 "2020-08-18T08:11:23Z")

</div>

[https://www.elastic.co/guide/en/elasticsearch/reference/7.8/search-multi-search.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.8/search-multi-search.html) has examples.

---

<div class="post-metadata">

### Author: ![richylyq](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@richylyq](https://discuss.elastic.co/u/richylyq)
#### Post date: [August 18, 2020, 8:11am UTC](https://discuss.elastic.co/t/is-there-a-limit-for-the-msearch/245361/7 "2020-08-18T08:11:50Z")

</div>

thanks for the assistance!

---

<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: [September 15, 2020, 8:12am UTC](https://discuss.elastic.co/t/is-there-a-limit-for-the-msearch/245361/8 "2020-09-15T08:12:08Z")

</div>

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