# Facet values as query criteria

**URL:** https://discuss.elastic.co/t/facet-values-as-query-criteria/5340
**Category:** Elasticsearch
**Created:** [September 9, 2011, 3:58pm UTC](https://discuss.elastic.co/t/facet-values-as-query-criteria/5340 "2011-09-09T15:58:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Wojciech\_Durczynski](https://avatars.discourse-cdn.com/v4/letter/w/fbc32d/32.png) [@Wojciech\_Durczynski](https://discuss.elastic.co/u/Wojciech_Durczynski)
#### Post date: [September 9, 2011, 3:58pm UTC](https://discuss.elastic.co/t/facet-values-as-query-criteria/5340/1 "2011-09-09T15:58:44Z")

</div>

Hello.

I think that facets are mainly useful in creating systems similar to  
e-shops.  
Search returns products which are shown on the page, and facets represent  
criteria that can be used to restrict products that are shown.  
So it would be great to:

1. Easily convert selected facet value (or values) into query/filters  
provided to next search operation
2. Count facet values of a facet ignoring if any of its values was selected  
or not (like on most of e-shops - checking any facet value recounts other  
facets excluding modified one)

Is there an easy way to do this using ES?

Regards  
Wojciech Durczyński

---

<div class="post-metadata">

### Author: ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)
#### Post date: [September 9, 2011, 4:47pm UTC](https://discuss.elastic.co/t/facet-values-as-query-criteria/5340/2 "2011-09-09T16:47:47Z")

</div>

1. How this is done depends on the client you are using.
2. [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/filter.html)

Thanks,  
Matt Weber

2011/9/9 Wojciech Durczyński [wojciech.durczynski@comarch.com](mailto:wojciech.durczynski@comarch.com)

> Hello.
> 
> I think that facets are mainly useful in creating systems similar to  
> e-shops.  
> Search returns products which are shown on the page, and facets represent  
> criteria that can be used to restrict products that are shown.  
> So it would be great to:
> 
> 1. Easily convert selected facet value (or values) into query/filters  
> provided to next search operation
> 2. Count facet values of a facet ignoring if any of its values was selected  
> or not (like on most of e-shops - checking any facet value recounts other  
> facets excluding modified one)
> 
> Is there an easy way to do this using ES?
> 
> Regards  
> Wojciech Durczyński

---

<div class="post-metadata">

### Author: ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)
#### Post date: [September 14, 2011, 8:16pm UTC](https://discuss.elastic.co/t/facet-values-as-query-criteria/5340/3 "2011-09-14T20:16:20Z")

</div>

You mean the multi select option I think.

Have a look:

> <https://github.com/elastic/elasticsearch/issues/650>

which is really powerful but not that easy compared to Solr. Here is  
the discussion:

> <https://github.com/elastic/elasticsearch/issues/499>

BTW: I implemented this on [http://jetsli.de/tweets](http://jetsli.de/tweets) (facet/filters  
visible if logged in) sourcecode @github

Regards,  
Peter.

---

<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, 3:54am UTC](https://discuss.elastic.co/t/facet-values-as-query-criteria/5340/4 "2017-07-06T03:54:22Z")

</div>


