Hello,
That’s not possible (yet) with the Hibernate Search API.
However, if you use the Elasticsearch backend, you can use the Elasticsearch extension to define your aggregation as JSON and retrieve results as JSON. That should allow you to do anything Elasticsearch has to offer.
I think what you’re looking for here is a terms
aggregation on field title
with a sub-aggregation: another terms
aggregation, this time on field name
. You’ll get a count of documents per title
, then for each title
you’ll get a count of documents per name
.