# How to support facet filters in custom facets?

**URL:** <https://discuss.elastic.co/t/how-to-support-facet-filters-in-custom-facets/10914>\
**Category:** Elasticsearch\
**Created:** [February 26, 2013, 11:31pm UTC](https://discuss.elastic.co/t/how-to-support-facet-filters-in-custom-facets/10914 "2013-02-26T23:31:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [February 26, 2013, 11:31pm UTC](https://discuss.elastic.co/t/how-to-support-facet-filters-in-custom-facets/10914/1 "2013-02-26T23:31:21Z")

</div>

Other than calling `addFilterFacetAndGlobal(builder, params)` in the  
overridden AbstractFacetBuilder.toXContent method, is there any other code  
that is required in order to support facet filters in custom facets?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [February 27, 2013, 11:19pm UTC](https://discuss.elastic.co/t/how-to-support-facet-filters-in-custom-facets/10914/2 "2013-02-27T23:19:44Z")

</div>

Does the upcoming facet refactoring obsolete this question?

On Tuesday, February 26, 2013 3:31:21 PM UTC-8, Eric Jain wrote:

> Other than calling `addFilterFacetAndGlobal(builder, params)` in the  
> overridden AbstractFacetBuilder.toXContent method, is there any other code  
> that is required in order to support facet filters in custom facets?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [February 27, 2013, 11:42pm UTC](https://discuss.elastic.co/t/how-to-support-facet-filters-in-custom-facets/10914/3 "2013-02-27T23:42:24Z")

</div>

I think it does... here is the commit for the facet refactor:

> <https://github.com/elastic/elasticsearch/commit/73a447da861d2413269064899443b297b9ca3f88>
>
> the main goal of the facet refactoring is to allow for two modes of facet execut…ion, collector based, that get callbacks as hist match, and post based, which iterates over all the relevant hits
> it also includes a some simplification of the facet implementation

It looks like the filter facet gets parsed and cached in:  
src/main/java/org/elasticsearch/search/facet/FacetParseElement.java

It get applied in the abstract Facet Builder in the "facetFilter" and  
"addFilterFacetAndGlobal" methods:  
src/main/java/org/elasticsearch/search/facet/FacetBuilder.java

Looking at all the built-in facets, they all seem to duplicate the  
facetFilter method though...

On Wed, Feb 27, 2013 at 3:19 PM, Eric Jain [eric.jain@gmail.com](mailto:eric.jain@gmail.com) wrote:

> Does the upcoming facet refactoring obsolete this question?
> 
> On Tuesday, February 26, 2013 3:31:21 PM UTC-8, Eric Jain wrote:
> 
> > Other than calling `addFilterFacetAndGlobal(builder, params)` in the  
> > overridden AbstractFacetBuilder.toXContent method, is there any other code  
> > that is required in order to support facet filters in custom facets?
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:49am UTC](https://discuss.elastic.co/t/how-to-support-facet-filters-in-custom-facets/10914/4 "2017-07-06T02:49:09Z")

</div>

Closed on July 6, 2017, 2:49am UTC


