On Mon, Nov 9, 2015 at 2:37 PM, Mikhail Khludnev <mkhlud...@griddynamics.com> wrote: > Yonik, > > I wonder is there a plan or a vision for something like > https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html > under JSON facets?
Hmmm, I couldn't quite grok that complicated command syntax... but the description seems straight-forward enough: "The following aggregations will return the top commenters' username that have commented and per top commenter the top tags of the issues the user has commented on:" So if I translate that into "books" and "reviews" that I use here: http://yonik.com/solr-nested-objects/ it sounds like we start with a set of book objects, then map to the child domain to facet on comments, then map back to the parent domain to facet on books again. >From that blog, this is the command that finds top review authors: json.facet={ top_reviewers : { type: terms, field: author_s, domain: { blockChildren : "type_s:book" } } } Now we just need to add a sub-facet that switches back to the parent domain to facet on something there (like genre... equiv to "tags" in the ES example): son.facet={ top_reviewers : { type: terms, field: author_s, domain: { blockChildren : "type_s:book" }, facet : { type:terms, field:genre, domain:{blockParent:"type_s:book"} } } } While there is certainly more work do be done with joins / block-joins, it seems like we can already do that specific example at least. -Yonik