How to choose optimal Point in Time for Elasticsearch Pagination with search_after?

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 .

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?

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

1 Like

Thanks Alex!

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