# Distance\_feature and optimal pagination?

**URL:** <https://discuss.elastic.co/t/distance-feature-and-optimal-pagination/287949>\
**Category:** Elasticsearch\
**Created:** [October 28, 2021, 5:44pm UTC](https://discuss.elastic.co/t/distance-feature-and-optimal-pagination/287949 "2021-10-28T17:44:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamis-laan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tamis-laan/32/96473_2.png) [@tamis-laan](https://discuss.elastic.co/u/tamis-laan)\
**Post date:** [October 28, 2021, 5:44pm UTC](https://discuss.elastic.co/t/distance-feature-and-optimal-pagination/287949/1 "2021-10-28T17:44:52Z")

</div>

I want to implement pagination over a search query that uses the **distance\_feature** using **location** and **time** and implement **pagination**.

Now because each request is unique in terms of it's location and time the sorting will be unique for each request. So I'm not sure what method of pagination is optimal for this kind of query.

**Should I use from size, search\_after, PID or scroll?**

I'm trying to support as many requests as possible. Also note I can make the max number of hits smaller then the standard 10000, let's say 1000 to 2000.

---

<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:** [November 25, 2021, 5:44pm UTC](https://discuss.elastic.co/t/distance-feature-and-optimal-pagination/287949/2 "2021-11-25T17:44:56Z")

</div>

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