Facets and a tree-like structure

Hello everybody

I want to index a tree-like structure in ElasticSearch. That structure is
an (let's call it) Item, that has a child Items. Each of the child may have
their own child Items.
What I'm trying to achieve is to make a text search on the Items and return
root elements which have at least one child in the whole structure that
matches the search.
In addition I need to have a facet on another field in the structure and
again, I would want it to count only the root elements that has at least
one child that matches.
I end up using parent/child objects in ElasticSearch, indexing root element
as parent and flattening the rest of the tree structure so every item in
the structure is a child of the root element.

The searching in this case works fine, but I'm not able to create a terms
facet on the child elements - I would like to have a facet on a particular
field in a child.

Is there a way to handle those facets any other way, or maybe another way
of handling the whole tree-like structure?

Thanks in advance
Paweł

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

I have the same problem as you, so far, no implemention is their in elasticsearch against the hierarchical facet,like path facet in bobo browse. but now i am trying a solution , let's say,
we have the model
a/b1/c
a/b2/d
i index the date as an array,
['a', 'a/b1', 'a/b1/c']
['a', 'a/b2', 'c/b2/d'],

when we need to facet 'a',

SearchResponse searchResponse = client1.prepareSearch()
.setQuery(matchAllQuery())
.addFacet(termsFacet("cate").fields("cate").size(10)
.facetFilter(
prefixFilter("cate", "a/"))
)
.execute().actionGet();

i get the result, 'a/b1' 1; 'a/b2' 1, though anothers, 'a' 2, is returned at the save time

Hmm, if you are still having this problem you can take a look at this:

On Friday, March 15, 2013 3:45:15 PM UTC+4, Paweł Młynarczyk wrote:

Hello everybody

I want to index a tree-like structure in Elasticsearch. That structure is
an (let's call it) Item, that has a child Items. Each of the child may have
their own child Items.
What I'm trying to achieve is to make a text search on the Items and
return root elements which have at least one child in the whole structure
that matches the search.
In addition I need to have a facet on another field in the structure and
again, I would want it to count only the root elements that has at least
one child that matches.
I end up using parent/child objects in Elasticsearch, indexing root
element as parent and flattening the rest of the tree structure so every
item in the structure is a child of the root element.

ElasticSearch tree structure search. · GitHub

The searching in this case works fine, but I'm not able to create a terms
facet on the child elements - I would like to have a facet on a particular
field in a child.

Is there a way to handle those facets any other way, or maybe another way
of handling the whole tree-like structure?

Thanks in advance
Paweł

--
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.
For more options, visit https://groups.google.com/groups/opt_out.