I am trying to implement pagination for quite heavy ES queries so I did some research on the options available, but documentation didn't answer some of my questions:
search_after is the recommended way for doing the deep pagination because, unlike the offset style pagination, it doesn't require to load all the previous pages in memory and allows to resume the data from the cursor position (assuming no new documents appear). But how are this cursor and sorted query results being stored in ES internally? Should I be concerned with high inodes consumption if I'm using search_after with the queries that yield millions of hits (even if I only paginate through hundreds of them)? what about memory usage?
Since search_after only allows to paginate in one direction, I am thinking of a workaround for going back: reverse the sort order and use the first entry's sort values to go to a previous page. What are the performance implications of reversing the query sort order like this? How does it change the resource consumption by ES?
I have found the official ES documentation to be quite terse when it comes to "how things actually work" so I will appreciate any deep dive / explanations / references here for a more solid understanding.