Aggs like Amazon

If we go to Amazon and search for tablet we get a list of tablets and on the left of screen we get facets to filter the query, like this:

http://imgur.com/9BM0Bpg

I know how to do facets (aggs) on elasticsearch, but looking at the results, seems that Amazon is doing a first query with a single aggs on category, and than it take the top categories and do another query with the custom aggs from categories.

The question is, can i do this with only one query or i need always to perform two queries? One to get the categories and another to get the aggs?