Sorted pagination in terms aggregation search

Hello!

I am trying to run an aggregation search with pagination. The solutions I found were either partitioning or using search_after.

With partitioning the sorting will only be inside of the partition, not the overall search.

and with search_after I don't see how it would be possible to skip from page 1 to 5. It would always only be the next page as I need to know the key from the page before so the user could only switch to the next page, but never skip pages.

Is there any way to do an aggregation search with pagination where pages can be skipped and the order is kept throughout the pages?