# Requested size is 1 for the query, but when the query is run on all the 8 shards it returns 8 records

**URL:** <https://discuss.elastic.co/t/requested-size-is-1-for-the-query-but-when-the-query-is-run-on-all-the-8-shards-it-returns-8-records/10857>\
**Category:** Elasticsearch\
**Created:** [February 22, 2013, 8:10pm UTC](https://discuss.elastic.co/t/requested-size-is-1-for-the-query-but-when-the-query-is-run-on-all-the-8-shards-it-returns-8-records/10857 "2013-02-22T20:10:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_2](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@john\_2](https://discuss.elastic.co/u/john_2)\
**Post date:** [February 22, 2013, 8:10pm UTC](https://discuss.elastic.co/t/requested-size-is-1-for-the-query-but-when-the-query-is-run-on-all-the-8-shards-it-returns-8-records/10857/1 "2013-02-22T20:10:25Z")

</div>

Hi,

This post is related to the below one.  
[https://groups.google.com/d/topic/elasticsearch/jJnOcAVP\_L4/discussion](https://groups.google.com/d/topic/elasticsearch/jJnOcAVP_L4/discussion)

The query has a from:"0" and size:"1", but this query gets 1 record from  
each of the 8 shards on the index and the java API displays 8 records. I'm  
not sure if this is some configuration issue.

Thanks,  
John

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [February 22, 2013, 8:15pm UTC](https://discuss.elastic.co/t/requested-size-is-1-for-the-query-but-when-the-query-is-run-on-all-the-8-shards-it-returns-8-records/10857/2 "2013-02-22T20:15:35Z")

</div>

Did you change your search type to query\_and\_fetch? With query\_and\_fetch,  
you will get n results from each shard, where n is the size requested.  
Default search type is query\_then\_fetch.

> **[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.

--  
Ivan

On Fri, Feb 22, 2013 at 12:10 PM, john [john2roll2@gmail.com](mailto:john2roll2@gmail.com) wrote:

> Hi,
> 
> This post is related to the below one.  
> [https://groups.google.com/d/topic/elasticsearch/jJnOcAVP\_L4/discussion](https://groups.google.com/d/topic/elasticsearch/jJnOcAVP_L4/discussion)
> 
> The query has a from:"0" and size:"1", but this query gets 1 record from  
> each of the 8 shards on the index and the java API displays 8 records. I'm  
> not sure if this is some configuration issue.
> 
> Thanks,  
> John
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [February 22, 2013, 8:21pm UTC](https://discuss.elastic.co/t/requested-size-is-1-for-the-query-but-when-the-query-is-run-on-all-the-8-shards-it-returns-8-records/10857/3 "2013-02-22T20:21:52Z")

</div>

It's hard to follow you in what your curl line looks like, so it's hard  
to comment. In Java API you use DFS query then fetch. So I think you  
also used in curl the parameter search\_type= dfs\_query\_then\_fetch. Also,  
you used setExplain(true) in Java which means, curl should have run  
through the \_explain endpoint. But I am not sure.  
I suggest you respect both parameters (explain and search\_type) and  
then, result size should be the same.

Jörg

Am 22.02.13 21:10, schrieb john:

> Hi,
> 
> This post is related to the below one.  
> [https://groups.google.com/d/topic/elasticsearch/jJnOcAVP\_L4/discussion](https://groups.google.com/d/topic/elasticsearch/jJnOcAVP_L4/discussion)
> 
> The query has a from:"0" and size:"1", but this query gets 1 record  
> from each of the 8 shards on the index and the java API displays 8  
> records. I'm not sure if this is some configuration issue.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![john\_2](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@john\_2](https://discuss.elastic.co/u/john_2)\
**Post date:** [February 22, 2013, 8:24pm UTC](https://discuss.elastic.co/t/requested-size-is-1-for-the-query-but-when-the-query-is-run-on-all-the-8-shards-it-returns-8-records/10857/4 "2013-02-22T20:24:26Z")

</div>

You're on it. That was it, thanks Ivan.

On Friday, 22 February 2013 14:15:35 UTC-6, Ivan Brusic wrote:

> Did you change your search type to query\_and\_fetch? With query\_and\_fetch,  
> you will get n results from each shard, where n is the size requested.  
> Default search type is query\_then\_fetch.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/search-type.html)
> 
> --  
> Ivan
> 
> On Fri, Feb 22, 2013 at 12:10 PM, john \<[john2...@gmail.com](mailto:john2...@gmail.com) \<javascript:\>\>wrote:
> 
> > Hi,
> > 
> > This post is related to the below one.  
> > [https://groups.google.com/d/topic/elasticsearch/jJnOcAVP\_L4/discussion](https://groups.google.com/d/topic/elasticsearch/jJnOcAVP_L4/discussion)
> > 
> > The query has a from:"0" and size:"1", but this query gets 1 record from  
> > each of the 8 shards on the index and the java API displays 8 records. I'm  
> > not sure if this is some configuration issue.
> > 
> > Thanks,  
> > John
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![john\_2](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@john\_2](https://discuss.elastic.co/u/john_2)\
**Post date:** [February 22, 2013, 8:26pm UTC](https://discuss.elastic.co/t/requested-size-is-1-for-the-query-but-when-the-query-is-run-on-all-the-8-shards-it-returns-8-records/10857/5 "2013-02-22T20:26:32Z")

</div>

Jörg, the code had been changed from the "DFS query then fetch" or "query  
then fetch" to "query and fetch" by someone. Sorry about the confusion i  
caused.

On Friday, 22 February 2013 14:21:52 UTC-6, Jörg Prante wrote:

> It's hard to follow you in what your curl line looks like, so it's hard  
> to comment. In Java API you use DFS query then fetch. So I think you  
> also used in curl the parameter search\_type= dfs\_query\_then\_fetch. Also,  
> you used setExplain(true) in Java which means, curl should have run  
> through the \_explain endpoint. But I am not sure.  
> I suggest you respect both parameters (explain and search\_type) and  
> then, result size should be the same.
> 
> Jörg
> 
> Am 22.02.13 21:10, schrieb john:
> 
> > Hi,
> > 
> > This post is related to the below one.  
> > [https://groups.google.com/d/topic/elasticsearch/jJnOcAVP\_L4/discussion](https://groups.google.com/d/topic/elasticsearch/jJnOcAVP_L4/discussion)
> > 
> > The query has a from:"0" and size:"1", but this query gets 1 record  
> > from each of the 8 shards on the index and the java API displays 8  
> > records. I'm not sure if this is some configuration issue.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:49am UTC](https://discuss.elastic.co/t/requested-size-is-1-for-the-query-but-when-the-query-is-run-on-all-the-8-shards-it-returns-8-records/10857/6 "2017-07-06T02:49:58Z")

</div>


