If I understand your case, you&#x27;d have to do it in multiple steps - you would get the results and paginated them, and record the hashes in a different store (eg redis) - then run the aggregations on a paginated set of hashes.   I understand it&#x27;s a pain, but I think it&#x27;s just a hard&#x2F;messy problem.  Like I said, if you can find other people that are solving this problem (could be there are..) then you can reference them to the ES people, I&#x27;m sure they&#x27;d like to find solutions.<p>It&#x27;s also possible you could restructure your data to make it easier to extract the way you want.. I&#x27;m not sure if that&#x27;s possible in your case, but many times in the NoSQL world, modeling your data in the best way for how you want to extract it is key for success.