# Path facets

**URL:** <https://discuss.elastic.co/t/path-facets/16701>\
**Category:** Elasticsearch\
**Created:** [March 30, 2014, 4:05pm UTC](https://discuss.elastic.co/t/path-facets/16701 "2014-03-30T16:05:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discuss.elastic.co/u/Volker)\
**Post date:** [March 30, 2014, 4:05pm UTC](https://discuss.elastic.co/t/path-facets/16701/1 "2014-03-30T16:05:18Z")

</div>

dear reader

I have a question about facets.

I have documents with a path as part of a document.

e.g.:

/america/  
/america/usa  
/america/usa/california  
/america/usa/new-york  
/america/mexico  
/europe/spain  
/europe/germany

I would like to drill down on an area and get a facet count for the next  
level.

If I filter in the facet e.g. for america I would like to get counts for

- /america/usa
- /america/mexico

I started with using a prefix filter in the facet to filter e.g. for  
america but then I get

- /america/usa
- /america/usa/california
- /america/usa/new-york
- /america/mexico

but I would like to get the facet counts for only the next level, so I can  
drill down on the area.

I tried a search for this topic, but I did not find a solution.

Hope that somebody can help.

Kind regards

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 31, 2014, 8:11am UTC](https://discuss.elastic.co/t/path-facets/16701/2 "2014-03-31T08:11:31Z")

</div>

Hey,

havent spent a lot of thought, if or how you can solve this directly, but  
wouldnt it be much easier if you used different fields like 'continent',  
'country', 'state', 'city' and would simply aggregate on those and use it  
for drill down? Or does it have to be generic and this is just an example?

--Alex

On Sun, Mar 30, 2014 at 6:05 PM, Volker [svs@klest.de](mailto:svs@klest.de) wrote:

> dear reader
> 
> I have a question about facets.
> 
> I have documents with a path as part of a document.
> 
> e.g.:
> 
> /america/  
> /america/usa  
> /america/usa/california  
> /america/usa/new-york  
> /america/mexico  
> /europe/spain  
> /europe/germany
> 
> I would like to drill down on an area and get a facet count for the next  
> level.
> 
> If I filter in the facet e.g. for america I would like to get counts for
> 
> - /america/usa
> - /america/mexico
> 
> I started with using a prefix filter in the facet to filter e.g. for  
> america but then I get
> 
> - /america/usa
> - /america/usa/california
> - /america/usa/new-york
> - /america/mexico
> 
> but I would like to get the facet counts for only the next level, so I can  
> drill down on the area.
> 
> I tried a search for this topic, but I did not find a solution.
> 
> Hope that somebody can help.
> 
> Kind regards
> 
> --  
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-jySAkOVaXJA%3D5kYBMb9VEWBojgwzS-Rw\_HrPhBWRZDg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-jySAkOVaXJA%3D5kYBMb9VEWBojgwzS-Rw_HrPhBWRZDg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discuss.elastic.co/u/Volker)\
**Post date:** [March 31, 2014, 10:10am UTC](https://discuss.elastic.co/t/path-facets/16701/3 "2014-03-31T10:10:17Z")

</div>

Hello Alex

thanks for your answer. Actually, it has to be generic, as this was only an  
example. In my use case it is just hirarchical data, where every path is  
from the same type (not country, state, etc).

I am in the process of migrating a lucene + bobobrowse application to ES.  
In bobobrowse there is a PathFacetHandler that does exactly that -- gives  
back facets for the next hirarchical level (and only that). So that it easy  
to drill down into the hirarchical data.

Is there a way to do this in ES?

kind regards

Am Montag, 31. März 2014 10:11:31 UTC+2 schrieb Alexander Reelsen:

> Hey,
> 
> havent spent a lot of thought, if or how you can solve this directly, but  
> wouldnt it be much easier if you used different fields like 'continent',  
> 'country', 'state', 'city' and would simply aggregate on those and use it  
> for drill down? Or does it have to be generic and this is just an example?
> 
> --Alex
> 
> On Sun, Mar 30, 2014 at 6:05 PM, Volker \<[s...@klest.de](mailto:s...@klest.de) \<javascript:\>\>wrote:
> 
> > dear reader
> > 
> > I have a question about facets.
> > 
> > I have documents with a path as part of a document.
> > 
> > e.g.:
> > 
> > /america/  
> > /america/usa  
> > /america/usa/california  
> > /america/usa/new-york  
> > /america/mexico  
> > /europe/spain  
> > /europe/germany
> > 
> > I would like to drill down on an area and get a facet count for the next  
> > level.
> > 
> > If I filter in the facet e.g. for america I would like to get counts for
> > 
> > - /america/usa
> > - /america/mexico
> > 
> > I started with using a prefix filter in the facet to filter e.g. for  
> > america but then I get
> > 
> > - /america/usa
> > - /america/usa/california
> > - /america/usa/new-york
> > - /america/mexico
> > 
> > but I would like to get the facet counts for only the next level, so I  
> > can drill down on the area.
> > 
> > I tried a search for this topic, but I did not find a solution.
> > 
> > Hope that somebody can help.
> > 
> > Kind regards
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2342e3de-aba1-4fce-999e-5930e722d40e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2342e3de-aba1-4fce-999e-5930e722d40e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discuss.elastic.co/u/Volker)\
**Post date:** [April 1, 2014, 4:22pm UTC](https://discuss.elastic.co/t/path-facets/16701/4 "2014-04-01T16:22:59Z")

</div>

do you remember your talk about ecommerce and ES in Hamburg? 🙂

viewing and drilling down in a catalogue is also a valid use case, where  
you need to drill down on hirarchical faceted data.

is there an easy way to do that in ES or do I have to aggregate the facets  
by myself?

kind regards

Am Montag, 31. März 2014 10:11:31 UTC+2 schrieb Alexander Reelsen:

> Hey,
> 
> havent spent a lot of thought, if or how you can solve this directly, but  
> wouldnt it be much easier if you used different fields like 'continent',  
> 'country', 'state', 'city' and would simply aggregate on those and use it  
> for drill down? Or does it have to be generic and this is just an example?
> 
> --Alex
> 
> On Sun, Mar 30, 2014 at 6:05 PM, Volker \<[s...@klest.de](mailto:s...@klest.de) \<javascript:\>\>wrote:
> 
> > dear reader
> > 
> > I have a question about facets.
> > 
> > I have documents with a path as part of a document.
> > 
> > e.g.:
> > 
> > /america/  
> > /america/usa  
> > /america/usa/california  
> > /america/usa/new-york  
> > /america/mexico  
> > /europe/spain  
> > /europe/germany
> > 
> > I would like to drill down on an area and get a facet count for the next  
> > level.
> > 
> > If I filter in the facet e.g. for america I would like to get counts for
> > 
> > - /america/usa
> > - /america/mexico
> > 
> > I started with using a prefix filter in the facet to filter e.g. for  
> > america but then I get
> > 
> > - /america/usa
> > - /america/usa/california
> > - /america/usa/new-york
> > - /america/mexico
> > 
> > but I would like to get the facet counts for only the next level, so I  
> > can drill down on the area.
> > 
> > I tried a search for this topic, but I did not find a solution.
> > 
> > Hope that somebody can help.
> > 
> > Kind regards
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 4, 2014, 7:57am UTC](https://discuss.elastic.co/t/path-facets/16701/5 "2014-04-04T07:57:58Z")

</div>

Hey,

I remember barely, that was already more than two months ago 😉

Again with the use case of categories, you may want to drill down in a  
hierarchical way, however this does not mean, that your data structures  
have to be like that (you could still handle your categories in an array  
and apply filters differently, so it looks like a hierarchy). However, I  
remember a talk about that at one of the last munich search meetups, dont  
see that the presentation is online though (need to reask the speaker for  
publishing it)

--Alex

On Tue, Apr 1, 2014 at 6:22 PM, Volker [svs@klest.de](mailto:svs@klest.de) wrote:

> do you remember your talk about ecommerce and ES in Hamburg? 🙂
> 
> viewing and drilling down in a catalogue is also a valid use case, where  
> you need to drill down on hirarchical faceted data.
> 
> is there an easy way to do that in ES or do I have to aggregate the facets  
> by myself?
> 
> kind regards
> 
> Am Montag, 31. März 2014 10:11:31 UTC+2 schrieb Alexander Reelsen:
> 
> > Hey,
> > 
> > havent spent a lot of thought, if or how you can solve this directly, but  
> > wouldnt it be much easier if you used different fields like 'continent',  
> > 'country', 'state', 'city' and would simply aggregate on those and use it  
> > for drill down? Or does it have to be generic and this is just an example?
> > 
> > --Alex
> > 
> > On Sun, Mar 30, 2014 at 6:05 PM, Volker [s...@klest.de](mailto:s...@klest.de) wrote:
> > 
> > > dear reader
> > > 
> > > I have a question about facets.
> > > 
> > > I have documents with a path as part of a document.
> > > 
> > > e.g.:
> > > 
> > > /america/  
> > > /america/usa  
> > > /america/usa/california  
> > > /america/usa/new-york  
> > > /america/mexico  
> > > /europe/spain  
> > > /europe/germany
> > > 
> > > I would like to drill down on an area and get a facet count for the next  
> > > level.
> > > 
> > > If I filter in the facet e.g. for america I would like to get counts for
> > > 
> > > - /america/usa
> > > - /america/mexico
> > > 
> > > I started with using a prefix filter in the facet to filter e.g. for  
> > > america but then I get
> > > 
> > > - /america/usa
> > > - /america/usa/california
> > > - /america/usa/new-york
> > > - /america/mexico
> > > 
> > > but I would like to get the facet counts for only the next level, so I  
> > > can drill down on the area.
> > > 
> > > I tried a search for this topic, but I did not find a solution.
> > > 
> > > Hope that somebody can help.
> > > 
> > > Kind regards
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%  
> > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-5USAVi5-cs26rO0EQr5uHcSbfwSfebyqXrj8k%2BEzM9w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-5USAVi5-cs26rO0EQr5uHcSbfwSfebyqXrj8k%2BEzM9w%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discuss.elastic.co/u/Volker)\
**Post date:** [April 7, 2014, 4:38pm UTC](https://discuss.elastic.co/t/path-facets/16701/6 "2014-04-07T16:38:24Z")

</div>

yes... just two month 🙂

in the meantime I have solved the problem. not with an array, but with a  
map. It works and it is fast 🙂

Thanks.

kind regards

PS: and maybe till may in Hamburg

Am Freitag, 4. April 2014 09:57:58 UTC+2 schrieb Alexander Reelsen:

> Hey,
> 
> I remember barely, that was already more than two months ago 😉
> 
> Again with the use case of categories, you may want to drill down in a  
> hierarchical way, however this does not mean, that your data structures  
> have to be like that (you could still handle your categories in an array  
> and apply filters differently, so it looks like a hierarchy). However, I  
> remember a talk about that at one of the last munich search meetups, dont  
> see that the presentation is online though (need to reask the speaker for  
> publishing it)
> 
> --Alex
> 
> On Tue, Apr 1, 2014 at 6:22 PM, Volker \<[s...@klest.de](mailto:s...@klest.de) \<javascript:\>\>wrote:
> 
> > do you remember your talk about ecommerce and ES in Hamburg? 🙂
> > 
> > viewing and drilling down in a catalogue is also a valid use case, where  
> > you need to drill down on hirarchical faceted data.
> > 
> > is there an easy way to do that in ES or do I have to aggregate the  
> > facets by myself?
> > 
> > kind regards
> > 
> > Am Montag, 31. März 2014 10:11:31 UTC+2 schrieb Alexander Reelsen:
> > 
> > > Hey,
> > > 
> > > havent spent a lot of thought, if or how you can solve this directly,  
> > > but wouldnt it be much easier if you used different fields like  
> > > 'continent', 'country', 'state', 'city' and would simply aggregate on those  
> > > and use it for drill down? Or does it have to be generic and this is just  
> > > an example?
> > > 
> > > --Alex
> > > 
> > > On Sun, Mar 30, 2014 at 6:05 PM, Volker [s...@klest.de](mailto:s...@klest.de) wrote:
> > > 
> > > > dear reader
> > > > 
> > > > I have a question about facets.
> > > > 
> > > > I have documents with a path as part of a document.
> > > > 
> > > > e.g.:
> > > > 
> > > > /america/  
> > > > /america/usa  
> > > > /america/usa/california  
> > > > /america/usa/new-york  
> > > > /america/mexico  
> > > > /europe/spain  
> > > > /europe/germany
> > > > 
> > > > I would like to drill down on an area and get a facet count for the  
> > > > next level.
> > > > 
> > > > If I filter in the facet e.g. for america I would like to get counts  
> > > > for
> > > > 
> > > > - /america/usa
> > > > - /america/mexico
> > > > 
> > > > I started with using a prefix filter in the facet to filter e.g. for  
> > > > america but then I get
> > > > 
> > > > - /america/usa
> > > > - /america/usa/california
> > > > - /america/usa/new-york
> > > > - /america/mexico
> > > > 
> > > > but I would like to get the facet counts for only the next level, so I  
> > > > can drill down on the area.
> > > > 
> > > > I tried a search for this topic, but I did not find a solution.
> > > > 
> > > > Hope that somebody can help.
> > > > 
> > > > Kind regards
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > 
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%  
> > > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ef682805-4148-4edc-a413-6ed41b6cafc4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ef682805-4148-4edc-a413-6ed41b6cafc4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 8, 2014, 9:36am UTC](https://discuss.elastic.co/t/path-facets/16701/7 "2014-04-08T09:36:52Z")

</div>

Hey,

is it worthwhile to share the solution you found for other people googling  
around? Or is it too specific?

--Alex

On Mon, Apr 7, 2014 at 6:38 PM, Volker [svs@klest.de](mailto:svs@klest.de) wrote:

> yes... just two month 🙂
> 
> in the meantime I have solved the problem. not with an array, but with a  
> map. It works and it is fast 🙂
> 
> Thanks.
> 
> kind regards
> 
> PS: and maybe till may in Hamburg
> 
> Am Freitag, 4. April 2014 09:57:58 UTC+2 schrieb Alexander Reelsen:
> 
> > Hey,
> > 
> > I remember barely, that was already more than two months ago 😉
> > 
> > Again with the use case of categories, you may want to drill down in a  
> > hierarchical way, however this does not mean, that your data structures  
> > have to be like that (you could still handle your categories in an array  
> > and apply filters differently, so it looks like a hierarchy). However, I  
> > remember a talk about that at one of the last munich search meetups, dont  
> > see that the presentation is online though (need to reask the speaker for  
> > publishing it)
> > 
> > --Alex
> > 
> > On Tue, Apr 1, 2014 at 6:22 PM, Volker [s...@klest.de](mailto:s...@klest.de) wrote:
> > 
> > > do you remember your talk about ecommerce and ES in Hamburg? 🙂
> > > 
> > > viewing and drilling down in a catalogue is also a valid use case, where  
> > > you need to drill down on hirarchical faceted data.
> > > 
> > > is there an easy way to do that in ES or do I have to aggregate the  
> > > facets by myself?
> > > 
> > > kind regards
> > > 
> > > Am Montag, 31. März 2014 10:11:31 UTC+2 schrieb Alexander Reelsen:
> > > 
> > > > Hey,
> > > > 
> > > > havent spent a lot of thought, if or how you can solve this directly,  
> > > > but wouldnt it be much easier if you used different fields like  
> > > > 'continent', 'country', 'state', 'city' and would simply aggregate on those  
> > > > and use it for drill down? Or does it have to be generic and this is just  
> > > > an example?
> > > > 
> > > > --Alex
> > > > 
> > > > On Sun, Mar 30, 2014 at 6:05 PM, Volker [s...@klest.de](mailto:s...@klest.de) wrote:
> > > > 
> > > > > dear reader
> > > > > 
> > > > > I have a question about facets.
> > > > > 
> > > > > I have documents with a path as part of a document.
> > > > > 
> > > > > e.g.:
> > > > > 
> > > > > /america/  
> > > > > /america/usa  
> > > > > /america/usa/california  
> > > > > /america/usa/new-york  
> > > > > /america/mexico  
> > > > > /europe/spain  
> > > > > /europe/germany
> > > > > 
> > > > > I would like to drill down on an area and get a facet count for the  
> > > > > next level.
> > > > > 
> > > > > If I filter in the facet e.g. for america I would like to get counts  
> > > > > for
> > > > > 
> > > > > - /america/usa
> > > > > - /america/mexico
> > > > > 
> > > > > I started with using a prefix filter in the facet to filter e.g. for  
> > > > > america but then I get
> > > > > 
> > > > > - /america/usa
> > > > > - /america/usa/california
> > > > > - /america/usa/new-york
> > > > > - /america/mexico
> > > > > 
> > > > > but I would like to get the facet counts for only the next level, so I  
> > > > > can drill down on the area.
> > > > > 
> > > > > I tried a search for this topic, but I did not find a solution.
> > > > > 
> > > > > Hope that somebody can help.
> > > > > 
> > > > > Kind regards
> > > > > 
> > > > > --  
> > > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > > 
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40goo  
> > > > > [glegroups.com](http://glegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%  
> > > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/ef682805-4148-4edc-a413-6ed41b6cafc4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ef682805-4148-4edc-a413-6ed41b6cafc4%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ef682805-4148-4edc-a413-6ed41b6cafc4%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ef682805-4148-4edc-a413-6ed41b6cafc4%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM85KZrT1gYFNvbhREydnShw9OYwZVFQ6x7rqLxcictM5A%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM85KZrT1gYFNvbhREydnShw9OYwZVFQ6x7rqLxcictM5A%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ramy](https://avatars.discourse-cdn.com/v4/letter/r/8491ac/32.png) [@Ramy](https://discuss.elastic.co/u/Ramy)\
**Post date:** [July 18, 2014, 8:16am UTC](https://discuss.elastic.co/t/path-facets/16701/8 "2014-07-18T08:16:24Z")

</div>

Hi Volker,  
I'm happy for you, that you found a solution for your problem. But as Alex  
said... It would be very nice and helpful, if you would publish your  
solution to help other users 😉  
cheers

Am Montag, 7. April 2014 18:38:24 UTC+2 schrieb Volker:

> yes... just two month 🙂
> 
> in the meantime I have solved the problem. not with an array, but with a  
> map. It works and it is fast 🙂
> 
> Thanks.
> 
> kind regards
> 
> PS: and maybe till may in Hamburg
> 
> Am Freitag, 4. April 2014 09:57:58 UTC+2 schrieb Alexander Reelsen:
> 
> > Hey,
> > 
> > I remember barely, that was already more than two months ago 😉
> > 
> > Again with the use case of categories, you may want to drill down in a  
> > hierarchical way, however this does not mean, that your data structures  
> > have to be like that (you could still handle your categories in an array  
> > and apply filters differently, so it looks like a hierarchy). However, I  
> > remember a talk about that at one of the last munich search meetups, dont  
> > see that the presentation is online though (need to reask the speaker for  
> > publishing it)
> > 
> > --Alex
> > 
> > On Tue, Apr 1, 2014 at 6:22 PM, Volker [s...@klest.de](mailto:s...@klest.de) wrote:
> > 
> > > do you remember your talk about ecommerce and ES in Hamburg? 🙂
> > > 
> > > viewing and drilling down in a catalogue is also a valid use case, where  
> > > you need to drill down on hirarchical faceted data.
> > > 
> > > is there an easy way to do that in ES or do I have to aggregate the  
> > > facets by myself?
> > > 
> > > kind regards
> > > 
> > > Am Montag, 31. März 2014 10:11:31 UTC+2 schrieb Alexander Reelsen:
> > > 
> > > > Hey,
> > > > 
> > > > havent spent a lot of thought, if or how you can solve this directly,  
> > > > but wouldnt it be much easier if you used different fields like  
> > > > 'continent', 'country', 'state', 'city' and would simply aggregate on those  
> > > > and use it for drill down? Or does it have to be generic and this is just  
> > > > an example?
> > > > 
> > > > --Alex
> > > > 
> > > > On Sun, Mar 30, 2014 at 6:05 PM, Volker [s...@klest.de](mailto:s...@klest.de) wrote:
> > > > 
> > > > > dear reader
> > > > > 
> > > > > I have a question about facets.
> > > > > 
> > > > > I have documents with a path as part of a document.
> > > > > 
> > > > > e.g.:
> > > > > 
> > > > > /america/  
> > > > > /america/usa  
> > > > > /america/usa/california  
> > > > > /america/usa/new-york  
> > > > > /america/mexico  
> > > > > /europe/spain  
> > > > > /europe/germany
> > > > > 
> > > > > I would like to drill down on an area and get a facet count for the  
> > > > > next level.
> > > > > 
> > > > > If I filter in the facet e.g. for america I would like to get counts  
> > > > > for
> > > > > 
> > > > > - /america/usa
> > > > > - /america/mexico
> > > > > 
> > > > > I started with using a prefix filter in the facet to filter e.g. for  
> > > > > america but then I get
> > > > > 
> > > > > - /america/usa
> > > > > - /america/usa/california
> > > > > - /america/usa/new-york
> > > > > - /america/mexico
> > > > > 
> > > > > but I would like to get the facet counts for only the next level, so I  
> > > > > can drill down on the area.
> > > > > 
> > > > > I tried a search for this topic, but I did not find a solution.
> > > > > 
> > > > > Hope that somebody can help.
> > > > > 
> > > > > Kind regards
> > > > > 
> > > > > --  
> > > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > > 
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%  
> > > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f825504-2d93-43ff-ab7f-f2dfd0866816%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d2516db2-416d-4d36-9284-6d145727f5a5%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/135002cb-5330-4e55-9b72-8bfa9bf16c2a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/135002cb-5330-4e55-9b72-8bfa9bf16c2a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:15am UTC](https://discuss.elastic.co/t/path-facets/16701/9 "2017-07-06T01:15:01Z")

</div>


