On a related note, if you can use Hibernate Search 6 aggregations to retrieve a list of the top N distinct terms of a given field for all matching documents. See here for an example.
That being said, you wouldn't get pagination.