Deep Pagination vs Scroll API


We are dealing with around 500k documents.
Should I use Deep Pagination or Scroll API to display the search results to the user in production ?

Can someone please suggest something ?


Scroll is for administrative actions because it leaves a context behind on the server. Deep pagination is expensive because Elasticsearch must use O(depth) memory and O(depth * ln(depth)) cpu to service the request.

500k isn't very many documents though. You could probably get away with deep pagination all the way down but you need to know what you are doing. I'd limit users to prevent pagination deeper than, say, 50k docs.