Query Help: Grouping and then counting resulting buckets

I'm having an issue getting a query to provide the count that I want. It
looks like something that may only be supported by "reducers" which are a
coming feature; however, any insight would be appreciated even if it is
just confirmation that this is not yet possible.

What I want to do is take a set of person documents, filter them, group the
remaining persons by address, sort them and do a top hits to narrow it down
to one person per household, and then count the number of "person types"
that are left. Everything except the last part, which would normally be a
terms aggregation on the person type attribute, is straight-forward. Can
not do a subaggregation of top_hits, so it does not seem possible currently
to accomplish this.

The following is a gist describing the query that we're trying to do:

https://gist.github.com/tcbeutler/1327e0a623bcdc52e89e

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/55ef9fed-6653-4fd3-a0f0-ba5d25d694cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.