How can I add additional parameters in aggregation?

I have documents with id and name and title.
I am making aggregation according name, but how can I get in the results
also the name and title?

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit

Hi Eylon,
You can use a sub aggregation for the title. If there's no name with 2 titles, the sub title aggregation will always contain a single bucket for each name with the same count as you have now. So you can now also retrieve the title.
In case there is a name with more then a single title, you'll get the aggregation for each combination.