# Changing size parameter changes ordering

**URL:** https://discuss.elastic.co/t/changing-size-parameter-changes-ordering/12085
**Category:** Elasticsearch
**Created:** [May 22, 2013, 10:33pm UTC](https://discuss.elastic.co/t/changing-size-parameter-changes-ordering/12085 "2013-05-22T22:33:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![eric\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_2/32/2328_2.png) [@eric\_2](https://discuss.elastic.co/u/eric_2)
#### Post date: [May 22, 2013, 10:33pm UTC](https://discuss.elastic.co/t/changing-size-parameter-changes-ordering/12085/1 "2013-05-22T22:33:40Z")

</div>

I'm using the following search:

> <https://gist.github.com/emarthinsen/5631387>

There are around 20,000 documents in the database - fairly small. This  
specific query returns around 300 results.

I'm using a sort function that generates a hash off of a random string  
combined with the document's id. It's entirely deterministic and should  
only generate a different order if the salt changes.

When 'from" is set to zero and "size" is set to 10,000 (a number larger  
than the total size of the index), then the first 10 documents show up in a  
certain order. If I change "size" to 10, then I'd expect the documents to  
show up in the same order as the first 10 documents from the query when  
"size" was set to 10,000. As you can guess, it doesn't. The first 10  
documents show up in completely different orders across the two searches.

Can anyone explain what's going on and how to fix it?

Regards,  
Eric

--  
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: ![Aldo\_Sarmiento](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aldo_sarmiento/32/2317_2.png) [@Aldo\_Sarmiento](https://discuss.elastic.co/u/Aldo_Sarmiento)
#### Post date: [May 22, 2013, 11:26pm UTC](https://discuss.elastic.co/t/changing-size-parameter-changes-ordering/12085/2 "2013-05-22T23:26:13Z")

</div>

Interestingly enough, I think we may be experiencing similar issues:

[https://groups.google.com/forum/#!topic/elasticsearch/kOL2uPgaPm8](https://groups.google.com/forum/#!topic/elasticsearch/kOL2uPgaPm8)

On Wednesday, May 22, 2013 3:33:40 PM UTC-7, [er...@sortfolio.com](mailto:er...@sortfolio.com) wrote:

> I'm using the following search:
> 
> [gist:5631387 · GitHub](https://gist.github.com/emarthinsen/5631387)
> 
> There are around 20,000 documents in the database - fairly small. This  
> specific query returns around 300 results.
> 
> I'm using a sort function that generates a hash off of a random string  
> combined with the document's id. It's entirely deterministic and should  
> only generate a different order if the salt changes.
> 
> When 'from" is set to zero and "size" is set to 10,000 (a number larger  
> than the total size of the index), then the first 10 documents show up in a  
> certain order. If I change "size" to 10, then I'd expect the documents to  
> show up in the same order as the first 10 documents from the query when  
> "size" was set to 10,000. As you can guess, it doesn't. The first 10  
> documents show up in completely different orders across the two searches.
> 
> Can anyone explain what's going on and how to fix it?
> 
> Regards,  
> Eric

--  
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: ![eric\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_2/32/2328_2.png) [@eric\_2](https://discuss.elastic.co/u/eric_2)
#### Post date: [May 23, 2013, 2:26am UTC](https://discuss.elastic.co/t/changing-size-parameter-changes-ordering/12085/3 "2013-05-23T02:26:33Z")

</div>

Let's hope!

On Wednesday, May 22, 2013 7:26:13 PM UTC-4, Aldo Sarmiento wrote:

> Interestingly enough, I think we may be experiencing similar issues:
> 
> [Redirecting to Google Groups](https://groups.google.com/forum/#!topic/elasticsearch/kOL2uPgaPm8)
> 
> On Wednesday, May 22, 2013 3:33:40 PM UTC-7, [er...@sortfolio.com](mailto:er...@sortfolio.com) wrote:
> 
> > I'm using the following search:
> > 
> > [gist:5631387 · GitHub](https://gist.github.com/emarthinsen/5631387)
> > 
> > There are around 20,000 documents in the database - fairly small. This  
> > specific query returns around 300 results.
> > 
> > I'm using a sort function that generates a hash off of a random string  
> > combined with the document's id. It's entirely deterministic and should  
> > only generate a different order if the salt changes.
> > 
> > When 'from" is set to zero and "size" is set to 10,000 (a number larger  
> > than the total size of the index), then the first 10 documents show up in a  
> > certain order. If I change "size" to 10, then I'd expect the documents to  
> > show up in the same order as the first 10 documents from the query when  
> > "size" was set to 10,000. As you can guess, it doesn't. The first 10  
> > documents show up in completely different orders across the two searches.
> > 
> > Can anyone explain what's going on and how to fix it?
> > 
> > Regards,  
> > Eric

--  
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: ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)
#### Post date: [May 23, 2013, 7:27am UTC](https://discuss.elastic.co/t/changing-size-parameter-changes-ordering/12085/4 "2013-05-23T07:27:40Z")

</div>

On Thursday, May 23, 2013 12:33:40 AM UTC+2, [er...@sortfolio.com](mailto:er...@sortfolio.com) wrote:

> I'm using the following search:
> 
> [gist:5631387 · GitHub](https://gist.github.com/emarthinsen/5631387)
> 
> There are around 20,000 documents in the database - fairly small. This  
> specific query returns around 300 results.
> 
> I'm using a sort function that generates a hash off of a random string  
> combined with the document's id. It's entirely deterministic and should  
> only generate a different order if the salt changes.
> 
> When 'from" is set to zero and "size" is set to 10,000 (a number larger  
> than the total size of the index), then the first 10 documents show up in a  
> certain order. If I change "size" to 10, then I'd expect the documents to  
> show up in the same order as the first 10 documents from the query when  
> "size" was set to 10,000. As you can guess, it doesn't. The first 10  
> documents show up in completely different orders across the two searches.
> 
> Can anyone explain what's going on and how to fix it?

can you build a simple testcase / gist that reproduces the problem somehow?

simon

> Regards,  
> Eric

--  
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:35am UTC](https://discuss.elastic.co/t/changing-size-parameter-changes-ordering/12085/5 "2017-07-06T02:35:15Z")

</div>


