Adding to Yonik response,
I think the feature shown by the Elastic Search blog is simply the
"Faceting on Parents" one,

"A special single bucket aggregation that enables aggregating on parent
docs from nested documents. "


Indeed it seems to not search on the parents then facets on children and
then on parents, it doesn't show the search but only the faceting at
children and parent level.
>From the line I quoted,we can guess it is searching at the children level,
faceting on the children and then faceting on the parents.
Then it describes a path to filter to a specific level of parents.
Anyway everything seems possible to me trough the ( I love it, can stop to
repeat it) Json Facet Approach.
Never tried with multiple hierarchical object levels, but I assume it
should not be a problem , using properly the domain: { blockParent :
"type_s:book" }  according to the level you want.

Cheers


[1] Yonik Blog quote

Faceting on Parents
> The main query gives us a document list of reviews by author_s:yonik
> If we want to facet on the book genre (cat_s field) then we need to
> switch the domain from the children (type_s:reviews) to the parents
> (type_s:books).
> $ curl http://localhost:8983/solr/demo/query -d '
> q=author_s:yonik&fl=id,comment_t&
> json.facet={
>   genres : {
>     type: terms,
>     field: cat_s,
>     domain: { blockParent : "type_s:book" }
>   }
> }'
> And we get a facet over the books which yonik reviewed:
> "response":{"numFound":2,"start":0,"docs":[
>     {
>       "id":"book1_c1",
>       "comment_t":["A great start to what looks like an epic series!"]},
>     {
>       "id":"book2_c1",
>       "comment_t":["Ahead of its time... I wonder if it helped inspire
> The Matrix?"]}]
> },
> "facets":{
>   "count":2,
>   "genres":{
>     "buckets":[{
>         "val":"fantasy",
>         "count":1},
>       {
>         "val":"sci-fi",
>         "count":1}]
> }}


On 11 November 2015 at 15:31, Yonik Seeley <ysee...@gmail.com> wrote:

> 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
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Reply via email to