# Bug?: Statistical Facet cannot use both script and facet\_filter

**URL:** <https://discuss.elastic.co/t/bug-statistical-facet-cannot-use-both-script-and-facet-filter/13500>\
**Category:** Elasticsearch\
**Created:** [September 6, 2013, 8:17pm UTC](https://discuss.elastic.co/t/bug-statistical-facet-cannot-use-both-script-and-facet-filter/13500 "2013-09-06T20:17:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jessica](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jessica](https://discuss.elastic.co/u/Jessica)\
**Post date:** [September 6, 2013, 8:17pm UTC](https://discuss.elastic.co/t/bug-statistical-facet-cannot-use-both-script-and-facet-filter/13500/1 "2013-09-06T20:17:33Z")

</div>

I believe I have found a bug:

If I have a facet that is a statistical I can do the following:  
facet with a script for field, no filters -\> works fine  
facet with a normal field with a facet\_filter -\> works fine  
\*BUG -\> facet with the same script field and the same facet\_filter -\>  
results are infinite (no error, but not working correctly)

Thanks,

--J

--  
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:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [September 6, 2013, 8:33pm UTC](https://discuss.elastic.co/t/bug-statistical-facet-cannot-use-both-script-and-facet-filter/13500/2 "2013-09-06T20:33:47Z")

</div>

Could you make a Gist that recreates the problem? Some sample docs and the  
three queries you just described?

What version of ES are you using?

-Zach

On Friday, September 6, 2013 4:17:33 PM UTC-4, J wrote:

> I believe I have found a bug:
> 
> If I have a facet that is a statistical I can do the following:  
> facet with a script for field, no filters -\> works fine  
> facet with a normal field with a facet\_filter -\> works fine  
> \*BUG -\> facet with the same script field and the same facet\_filter -\>  
> results are infinite (no error, but not working correctly)
> 
> Thanks,
> 
> --J

--  
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:** ![Jessica](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jessica](https://discuss.elastic.co/u/Jessica)\
**Post date:** [September 9, 2013, 3:59pm UTC](https://discuss.elastic.co/t/bug-statistical-facet-cannot-use-both-script-and-facet-filter/13500/3 "2013-09-09T15:59:54Z")

</div>

I think this gist should be close to what I was doing with my data,  
somewhat simplified. I have moved on from this so I can't spend time  
working on it any longer, but this should illustrate what I was doing at  
least, might need some tweaks to fully run:

> <https://gist.github.com/anonymous/6497664>

I'm on version 0.90.3

On Fri, Sep 6, 2013 at 3:33 PM, Zachary Tong [zacharyjtong@gmail.com](mailto:zacharyjtong@gmail.com) wrote:

> Could you make a Gist that recreates the problem? Some sample docs and  
> the three queries you just described?
> 
> What version of ES are you using?
> 
> -Zach
> 
> On Friday, September 6, 2013 4:17:33 PM UTC-4, J wrote:
> 
> > I believe I have found a bug:
> > 
> > If I have a facet that is a statistical I can do the following:  
> > facet with a script for field, no filters -\> works fine  
> > facet with a normal field with a facet\_filter -\> works fine  
> > \*BUG -\> facet with the same script field and the same facet\_filter -\>  
> > results are infinite (no error, but not working correctly)
> > 
> > Thanks,
> > 
> > --J
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/B4Xtp\_\_kieg/unsubscribe](https://groups.google.com/d/topic/elasticsearch/B4Xtp__kieg/unsubscribe).  
> To unsubscribe from this group and all its topics, 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:17am UTC](https://discuss.elastic.co/t/bug-statistical-facet-cannot-use-both-script-and-facet-filter/13500/4 "2017-07-06T02:17:27Z")

</div>


