# How to choose optimal Point in Time for Elasticsearch Pagination with search\_after?

**URL:** <https://discuss.elastic.co/t/how-to-choose-optimal-point-in-time-for-elasticsearch-pagination-with-search-after/280427>\
**Category:** Elasticsearch\
**Created:** [August 4, 2021, 12:35pm UTC](https://discuss.elastic.co/t/how-to-choose-optimal-point-in-time-for-elasticsearch-pagination-with-search-after/280427 "2021-08-04T12:35:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nishikant\_Tayade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nishikant_tayade/32/84159_2.png) [@Nishikant\_Tayade](https://discuss.elastic.co/u/Nishikant_Tayade)\
**Post date:** [August 4, 2021, 12:35pm UTC](https://discuss.elastic.co/t/how-to-choose-optimal-point-in-time-for-elasticsearch-pagination-with-search-after/280427/1 "2021-08-04T12:35:00Z")

</div>

I have large datasets, for which I am trying to perform the pagination, while reading the documentation I came across the **PIT(Point-In-Time)** concepts, which will help to get the consistent results.

I am using below API to open PIT, **after 1m, it will be closed**.

```auto
POST /order/_pit?keep_alive=1m

```

Questions is: How to come up with the best **PIT** time(ex:1m,5m), so that my search request will be more performant?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 4, 2021, 1:14pm UTC](https://discuss.elastic.co/t/how-to-choose-optimal-point-in-time-for-elasticsearch-pagination-with-search-after/280427/2 "2021-08-04T13:14:41Z")

</div>

Hey,

so the keep alive time is not about performance, but about the question how long resources should be kept open before those are auto-closed.

One thing you should try to prevent is to open a point in time request for every new search request coming in, if you have a lot of those. What you can do however is to reuse a point in-time request across an arbitrary amount of searches. You could for example open a new request every few minutes and reuse that one across sessions/users using your application.

Hope this helps. If not, please be more specific why you think this has something to do with performance so we can dive deeper into that.

--Alex

---

<div class="post-metadata">

**Author:** ![Nishikant\_Tayade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nishikant_tayade/32/84159_2.png) [@Nishikant\_Tayade](https://discuss.elastic.co/u/Nishikant_Tayade)\
**Post date:** [August 4, 2021, 3:41pm UTC](https://discuss.elastic.co/t/how-to-choose-optimal-point-in-time-for-elasticsearch-pagination-with-search-after/280427/3 "2021-08-04T15:41:27Z")

</div>

Thanks Alex!

---

<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:** [September 1, 2021, 3:42pm UTC](https://discuss.elastic.co/t/how-to-choose-optimal-point-in-time-for-elasticsearch-pagination-with-search-after/280427/4 "2021-09-01T15:42:17Z")

</div>

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