# Is this use of Facets bonkers?

**URL:** <https://discuss.elastic.co/t/is-this-use-of-facets-bonkers/3590>\
**Category:** Elasticsearch\
**Created:** [November 20, 2010, 12:58pm UTC](https://discuss.elastic.co/t/is-this-use-of-facets-bonkers/3590 "2010-11-20T12:58:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timber](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@Timber](https://discuss.elastic.co/u/Timber)\
**Post date:** [November 20, 2010, 12:58pm UTC](https://discuss.elastic.co/t/is-this-use-of-facets-bonkers/3590/1 "2010-11-20T12:58:32Z")

</div>

Hi,

On an e-commerce site I want to display the facets from a search so  
that you don't need to remove a current facet selection before you can  
select a different one. Once you select an age range (9-12 years for  
example) the search will return with only the selected age range in  
the age range facet. I want to display all the possible age range  
facets (taking account of all the other facets selected) with the 9-12  
years selected.

To do this I am contemplating reissuing the query for each facet in  
turn without the filter applied for that particular facet so that I  
can obtain the list of possible options available for this facet.

The problem in doing this is that it will require an extra query for  
each facet that we want to display. Can I assume that I can maintain  
acceptable performance by using more servers and issuing the extra  
queries in parallel? Can anybody think of a less clumsy solution to  
this?

Thanks

Tim

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 20, 2010, 1:06pm UTC](https://discuss.elastic.co/t/is-this-use-of-facets-bonkers/3590/2 "2010-11-20T13:06:27Z")

</div>

```
    Hi,Â Â If I understood correctly the question, then you can do all with a single search request. Use the range facet to define several ranges and you can get count on them. And have two of those, one that is global (not bounded by the user query) and one that isn't (bounded by the use query). Note that each facet can also have an addition filter to further restrict the docs it will run on.-shay.banon
	
	
    On Saturday, November 20, 2010 at 2:58 PM, Timber wrote:
    
        Hi,On an e-commerce site I want to display the facets from a search sothat you don't need to remove a current facet selection before you canselect a different one. Once you select an age range (9-12 years forexample) the search will return with only the selected age range inthe age range facet. I want to display all the possible age rangefacets (taking account of all the other facets selected) with the 9-12years selected.To do this I am contemplating reissuing the query for each facet inturn without the filter applied for that particular facet so that Ican obtain the list of possible options available for this facet.The problem in doing this is that it will require an extra query foreach facet that we want to display. Can I assume that I can maintainacceptable performance by using more servers and issuing the extraqueries in parallel? Can anybody think of a less clumsy solution tothis?ThanksTim
```

---

<div class="post-metadata">

**Author:** ![Timber](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@Timber](https://discuss.elastic.co/u/Timber)\
**Post date:** [November 20, 2010, 1:44pm UTC](https://discuss.elastic.co/t/is-this-use-of-facets-bonkers/3590/3 "2010-11-20T13:44:11Z")

</div>

That works a treat.

Thank you

On Nov 20, 1:06 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> ```
> Hi, If I understood correctly the question, then you can do all with a single search request. Use the range facet to define several ranges and you can get count on them. And have two of those, one that is global (not bounded by the user query) and one that isn't (bounded by the use query). Note that each facet can also have an addition filter to further restrict the docs it will run on.-shay.banon
> 
> On Saturday, November 20, 2010 at 2:58 PM, Timber wrote:
> 
> Hi,On an e-commerce site I want to display the facets from a search sothat you don't need to remove a current facet selection before you canselect a different one. Once you select an age range (9-12 years forexample) the search will return with only the selected age range inthe age range facet. I want to display all the possible age rangefacets (taking account of all the other facets selected) with the 9-12years selected.To do this I am contemplating reissuing the query for each facet inturn without the filter applied for that particular facet so that Ican obtain the list of possible options available for this facet.The problem in doing this is that it will require an extra query foreach facet that we want to display. Can I assume that I can maintainacceptable performance by using more servers and issuing the extraqueries in parallel? Can anybody think of a less clumsy solution tothis?ThanksTim
> 
> ```

---

<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, 4:16am UTC](https://discuss.elastic.co/t/is-this-use-of-facets-bonkers/3590/4 "2017-07-06T04:16:14Z")

</div>

Closed on July 6, 2017, 4:16am UTC


