# How to paginate items with specified order with ElasticSearch

**URL:** <https://discuss.elastic.co/t/how-to-paginate-items-with-specified-order-with-elasticsearch/217888>\
**Category:** Elasticsearch\
**Created:** [February 4, 2020, 10:27pm UTC](https://discuss.elastic.co/t/how-to-paginate-items-with-specified-order-with-elasticsearch/217888 "2020-02-04T22:27:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmessin1](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@jmessin1](https://discuss.elastic.co/u/jmessin1)\
**Post date:** [February 4, 2020, 10:27pm UTC](https://discuss.elastic.co/t/how-to-paginate-items-with-specified-order-with-elasticsearch/217888/1 "2020-02-04T22:27:24Z")

</div>

Im trying to browse a user's ratings sorted by their rating date with pagination. If it's simply getting a page of results then I can just paginate before calling ElasticSearch, i.e. fetch 20 items sorted by rating date, fetch 20 items from ES by itemId, sort results by the order of ratings.

But I run into an issue if the user wants to filter their results, i.e. their ratings w/ items that are "$50 or less". If I have the `offset` and `limit` parameters it will just return the first 20 items it finds since I sort it after it returns from ES.

Is there a way to call ES with all rating IDs, then sort, filter & paginate on ES?

---

<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:** [March 3, 2020, 10:27pm UTC](https://discuss.elastic.co/t/how-to-paginate-items-with-specified-order-with-elasticsearch/217888/2 "2020-03-03T22:27:30Z")

</div>

Closed on March 3, 2020, 10:27pm UTC

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