# Search result hit total

**URL:** <https://discuss.elastic.co/t/search-result-hit-total/4216>\
**Category:** Elasticsearch\
**Created:** [April 11, 2011, 5:58pm UTC](https://discuss.elastic.co/t/search-result-hit-total/4216 "2011-04-11T17:58:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitfy](https://avatars.discourse-cdn.com/v4/letter/g/85f322/32.png) [@gitfy](https://discuss.elastic.co/u/gitfy)\
**Post date:** [April 11, 2011, 5:58pm UTC](https://discuss.elastic.co/t/search-result-hit-total/4216/1 "2011-04-11T17:58:11Z")

</div>

When i do a search, i get the results as

{  
"took" : 1,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 26,  
"max\_score" : 1.0,

.....

}

Even though the hits.total says 26, i get back only 10 records. is  
there a max cap on how many records that is returned, if so, how to  
iterate for more results.

can this be specified in the query with some limit parameter on how  
records to return ?

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [April 11, 2011, 6:04pm UTC](https://discuss.elastic.co/t/search-result-hit-total/4216/2 "2011-04-11T18:04:13Z")

</div>

> Even though the hits.total says 26, i get back only 10 records. is  
> there a max cap on how many records that is returned, if so, how to  
> iterate for more results.
> 
> can this be specified in the query with some limit parameter on how  
> records to return ?

all explained in the docs:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

clint

---

<div class="post-metadata">

**Author:** ![danoyoung](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@danoyoung](https://discuss.elastic.co/u/danoyoung)\
**Post date:** [April 11, 2011, 6:04pm UTC](https://discuss.elastic.co/t/search-result-hit-total/4216/3 "2011-04-11T18:04:48Z")

</div>

By default only 10 rows are returned.....you can pass in the size:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Mon, Apr 11, 2011 at 11:58 AM, gitfy [lenin.kumar.s@gmail.com](mailto:lenin.kumar.s@gmail.com) wrote:

> When i do a search, i get the results as
> 
> {  
> "took" : 1,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 26,  
> "max\_score" : 1.0,
> 
> .....
> 
> }
> 
> Even though the hits.total says 26, i get back only 10 records. is  
> there a max cap on how many records that is returned, if so, how to  
> iterate for more results.
> 
> can this be specified in the query with some limit parameter on how  
> records to return ?

---

<div class="post-metadata">

**Author:** ![gitfy](https://avatars.discourse-cdn.com/v4/letter/g/85f322/32.png) [@gitfy](https://discuss.elastic.co/u/gitfy)\
**Post date:** [April 11, 2011, 6:21pm UTC](https://discuss.elastic.co/t/search-result-hit-total/4216/4 "2011-04-11T18:21:16Z")

</div>

Thanks...that helps.

On Apr 11, 11:04 am, Dan Young [danoyo...@gmail.com](mailto:danoyo...@gmail.com) wrote:

> By default only 10 rows are returned.....you can pass in the size:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/from-size.html)
> 
> On Mon, Apr 11, 2011 at 11:58 AM, gitfy [lenin.kuma...@gmail.com](mailto:lenin.kuma...@gmail.com) wrote:
> 
> > When i do a search, i get the results as
> 
> > {  
> > "took" : 1,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 26,  
> > "max\_score" : 1.0,
> 
> > .....
> 
> > }
> 
> > Even though the hits.total says 26, i get back only 10 records. is  
> > there a max cap on how many records that is returned, if so, how to  
> > iterate for more results.
> 
> > can this be specified in the query with some limit parameter on how  
> > records to return ?

---

<div class="post-metadata">

**Author:** ![gitfy](https://avatars.discourse-cdn.com/v4/letter/g/85f322/32.png) [@gitfy](https://discuss.elastic.co/u/gitfy)\
**Post date:** [April 11, 2011, 9:27pm UTC](https://discuss.elastic.co/t/search-result-hit-total/4216/5 "2011-04-11T21:27:34Z")

</div>

One more question on this regard.....

$ curl -XGET '[http://localhost:9200/twitter/tweet,user/\_count](http://localhost:9200/twitter/tweet,user/_count)?  
q=user:kimchy'

when i use the count feature, it provide the total matches across the  
types, but it would nice if it could tell how many in the individual  
types (instead of firing separate queries for each types).

Also, when i use the from and size, to search among different types,  
is there a possibility to size number of records for each types ?

Otherwise, the global search doesn't really make much sense, if one  
has to exhaust all the records of a particular type before looking  
into another type....

On Apr 11, 11:21 am, gitfy [lenin.kuma...@gmail.com](mailto:lenin.kuma...@gmail.com) wrote:

> Thanks...that helps.
> 
> On Apr 11, 11:04 am, Dan Young [danoyo...@gmail.com](mailto:danoyo...@gmail.com) wrote:
> 
> > By default only 10 rows are returned.....you can pass in the size:
> 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/from-size.html)
> 
> > On Mon, Apr 11, 2011 at 11:58 AM, gitfy [lenin.kuma...@gmail.com](mailto:lenin.kuma...@gmail.com) wrote:
> > 
> > > When i do a search, i get the results as
> 
> > > {  
> > > "took" : 1,  
> > > "timed\_out" : false,  
> > > "\_shards" : {  
> > > "total" : 5,  
> > > "successful" : 5,  
> > > "failed" : 0  
> > > },  
> > > "hits" : {  
> > > "total" : 26,  
> > > "max\_score" : 1.0,
> 
> > > .....
> 
> > > }
> 
> > > Even though the hits.total says 26, i get back only 10 records. is  
> > > there a max cap on how many records that is returned, if so, how to  
> > > iterate for more results.
> 
> > > can this be specified in the query with some limit parameter on how  
> > > records to return ?

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [April 12, 2011, 5:25am UTC](https://discuss.elastic.co/t/search-result-hit-total/4216/6 "2011-04-12T05:25:17Z")

</div>

Hi,

On Mon, Apr 11, 2011 at 11:27 PM, gitfy [lenin.kumar.s@gmail.com](mailto:lenin.kumar.s@gmail.com) wrote:

> One more question on this regard.....
> 
> $ curl -XGET '[http://localhost:9200/twitter/tweet,user/\_count](http://localhost:9200/twitter/tweet,user/_count)?  
> q=user:kimchy'
> 
> when i use the count feature, it provide the total matches across the  
> types, but it would nice if it could tell how many in the individual  
> types (instead of firing separate queries for each types).

You can use facets for this on top of \_index or \_type fields:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

> Also, when i use the from and size, to search among different types,  
> is there a possibility to size number of records for each types ?

You want to tell ES that you want it to include 2 documents from index A and  
8 documents from index B into the first 10 most relevant results? This is  
not possible.

> Otherwise, the global search doesn't really make much sense, if one  
> has to exhaust all the records of a particular type before looking  
> into another type....
> 
> On Apr 11, 11:21 am, gitfy [lenin.kuma...@gmail.com](mailto:lenin.kuma...@gmail.com) wrote:
> 
> > Thanks...that helps.
> > 
> > On Apr 11, 11:04 am, Dan Young [danoyo...@gmail.com](mailto:danoyo...@gmail.com) wrote:
> > 
> > > By default only 10 rows are returned.....you can pass in the size:
> > 
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/from-size.html)
> > 
> > > On Mon, Apr 11, 2011 at 11:58 AM, gitfy [lenin.kuma...@gmail.com](mailto:lenin.kuma...@gmail.com)  
> > > wrote:
> > > 
> > > > When i do a search, i get the results as
> > 
> > > > {  
> > > > "took" : 1,  
> > > > "timed\_out" : false,  
> > > > "\_shards" : {  
> > > > "total" : 5,  
> > > > "successful" : 5,  
> > > > "failed" : 0  
> > > > },  
> > > > "hits" : {  
> > > > "total" : 26,  
> > > > "max\_score" : 1.0,
> > 
> > > > .....
> > 
> > > > }
> > 
> > > > Even though the hits.total says 26, i get back only 10 records. is  
> > > > there a max cap on how many records that is returned, if so, how to  
> > > > iterate for more results.
> > 
> > > > can this be specified in the query with some limit parameter on how  
> > > > records to return ?

Regards,  
Lukas

---

<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 6, 2017, 4:08am UTC](https://discuss.elastic.co/t/search-result-hit-total/4216/7 "2017-07-06T04:08:31Z")

</div>


