# Pagination using From/size without specifying "sort"

**URL:** <https://discuss.elastic.co/t/pagination-using-from-size-without-specifying-sort/10012>\
**Category:** Elasticsearch\
**Created:** [December 10, 2012, 7:29am UTC](https://discuss.elastic.co/t/pagination-using-from-size-without-specifying-sort/10012 "2012-12-10T07:29:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![govind201\_2](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@govind201\_2](https://discuss.elastic.co/u/govind201_2)\
**Post date:** [December 10, 2012, 7:29am UTC](https://discuss.elastic.co/t/pagination-using-from-size-without-specifying-sort/10012/1 "2012-12-10T07:29:09Z")

</div>

I've built my API on Elasticsearch such that users can specify their  
filters and retrieve data accordingly. For example, a user can specify  
"return all products of brand Samsung" and I internally run something along  
the lines of:  
'{"query" : {"filtered" : {"query" : {"match\_all" : {}}, "filter" :  
{"term" : {"brand" : "Samsung"}}}}, "size" : 10, "from" : 50}'

Each API call returns 10 results at a time. However, I want the user to be  
able to paginate through the responses if it interests him/her. Hence, I  
also allow the user to specify the "from" field.

So my question is this: can I guarantee genuine pagination if the user only  
changes the "from" field in successive queries? By "genuine" pagination, I  
mean, can I be sure that successive pages won't contain the same document?

Note:

1. I'm not using any scroll/scan features.
2. API queries may be made several days apart, so caching is not guaranteed.
3. I'm not using any "sort" fields so as to save on memory used.
4. Queries may contain only "query" fields, only "filter" fields, or both.  
Hence scoring may or may not play a role.

--

---

<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, 3:00am UTC](https://discuss.elastic.co/t/pagination-using-from-size-without-specifying-sort/10012/2 "2017-07-06T03:00:37Z")

</div>


