# How to use Filter in DateHistogram Facet?

**URL:** <https://discuss.elastic.co/t/how-to-use-filter-in-datehistogram-facet/7775>\
**Category:** Elasticsearch\
**Created:** [May 19, 2012, 4:32pm UTC](https://discuss.elastic.co/t/how-to-use-filter-in-datehistogram-facet/7775 "2012-05-19T16:32:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijuitech](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@vijuitech](https://discuss.elastic.co/u/vijuitech)\
**Post date:** [May 19, 2012, 4:32pm UTC](https://discuss.elastic.co/t/how-to-use-filter-in-datehistogram-facet/7775/1 "2012-05-19T16:32:32Z")

</div>

Hi,  
Is there any method to use Facet Filter in Date Histogram Facet?

Cheers!

George

---

<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:** [May 20, 2012, 9:58pm UTC](https://discuss.elastic.co/t/how-to-use-filter-in-datehistogram-facet/7775/2 "2012-05-20T21:58:05Z")

</div>

Yes, you can simply add a facet\_filter to it.

On Sat, May 19, 2012 at 6:32 PM, George Viju [vijuitech@gmail.com](mailto:vijuitech@gmail.com) wrote:

> Hi,  
> Is there any method to use Facet Filter in Date Histogram Facet?
> 
> Cheers!
> 
> George

---

<div class="post-metadata">

**Author:** ![vijuitech](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@vijuitech](https://discuss.elastic.co/u/vijuitech)\
**Post date:** [May 21, 2012, 5:49am UTC](https://discuss.elastic.co/t/how-to-use-filter-in-datehistogram-facet/7775/3 "2012-05-21T05:49:46Z")

</div>

Thanks Shay!

I tried the Facet filter for the Two Tones Positive and Negative. But  
I am getting the Total data for each date range here (Not getting  
Positive and Negative count Separately). It is not filtering

It is getting as

For the same date range For Positive.

"createddaterange1" : {  
"\_type" : "date\_histogram",  
"entries" :   
},

For the same date range For Negative.. But the count I got here is  
the (Combination of Both Positive and Negative)  
"createddaterange2" : {  
"\_type" : "date\_histogram",  
"entries" : [ {  
"time" : 1337212800000,  
"count" : 34,  
"min" : 1.337269645E12,  
"max" : 1.33729302E12,  
"total" : 4.5467295833E13,  
"total\_count" : 34,  
"mean" : 1.3372734068529412E12  
}, {  
"time" : 1337299200000,  
"count" : 1,  
"min" : 1.33737948E12,  
"max" : 1.33737948E12,  
"total" : 1.33737948E12,  
"total\_count" : 1,  
"mean" : 1.33737948E12  
},

How can I get the Positive and Negative counts separately?

Thanks!

Cheers!

George!

On May 21, 2:58 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Yes, you can simply add a facet\_filter to it.
> 
> On Sat, May 19, 2012 at 6:32 PM, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com) wrote:
> 
> > Hi,  
> > Is there any method to use Facet Filter in Date Histogram Facet?
> 
> > Cheers!
> 
> > George

---

<div class="post-metadata">

**Author:** ![vijuitech](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@vijuitech](https://discuss.elastic.co/u/vijuitech)\
**Post date:** [May 22, 2012, 9:48am UTC](https://discuss.elastic.co/t/how-to-use-filter-in-datehistogram-facet/7775/4 "2012-05-22T09:48:31Z")

</div>

Hi,  
Which type of Filter did DateHistogram Facet support? Is it  
possible to use Term Filter in DateHistogram Facet?

cheers!

George

On May 21, 10:49 am, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com) wrote:

> Thanks Shay!
> 
> I tried theFacetfilterfor the Two Tones Positive and Negative. But  
> I am getting the Total data for eachdaterange here (Not getting  
> Positive and Negative count Separately). It is not filtering
> 
> It is getting as
> 
> For the samedaterange For Positive.
> 
> "createddaterange1" : {  
> "\_type" : "date\_histogram",  
> "entries" :   
> },
> 
> For the samedaterange For Negative.. But the count I got here is  
> the (Combination of Both Positive and Negative)  
> "createddaterange2" : {  
> "\_type" : "date\_histogram",  
> "entries" : [ {  
> "time" : 1337212800000,  
> "count" : 34,  
> "min" : 1.337269645E12,  
> "max" : 1.33729302E12,  
> "total" : 4.5467295833E13,  
> "total\_count" : 34,  
> "mean" : 1.3372734068529412E12  
> }, {  
> "time" : 1337299200000,  
> "count" : 1,  
> "min" : 1.33737948E12,  
> "max" : 1.33737948E12,  
> "total" : 1.33737948E12,  
> "total\_count" : 1,  
> "mean" : 1.33737948E12  
> },
> 
> How can I get the Positive and Negative counts separately?
> 
> Thanks!
> 
> Cheers!
> 
> George!
> 
> On May 21, 2:58 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > Yes, you can simply add a facet\_filter to it.
> 
> > On Sat, May 19, 2012 at 6:32 PM, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com) wrote:
> > 
> > > Hi,  
> > > Is there any method to useFacetFilterinDateHistogramFacet?
> 
> > > Cheers!
> 
> > > George

---

<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:** [May 23, 2012, 10:38pm UTC](https://discuss.elastic.co/t/how-to-use-filter-in-datehistogram-facet/7775/5 "2012-05-23T22:38:16Z")

</div>

You can use any filter in the facet\_filter element. You previous mail  
really assumed too much regarding my knowledge of your app... . If you  
don't understand something, gist a simple recreation (see  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)), that would be the fastest way to help.

On Tue, May 22, 2012 at 11:48 AM, George Viju [vijuitech@gmail.com](mailto:vijuitech@gmail.com) wrote:

> Hi,  
> Which type of Filter did DateHistogram Facet support? Is it  
> possible to use Term Filter in DateHistogram Facet?
> 
> cheers!
> 
> George
> 
> On May 21, 10:49 am, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com) wrote:
> 
> > Thanks Shay!
> > 
> > I tried theFacetfilterfor the Two Tones Positive and Negative. But  
> > I am getting the Total data for eachdaterange here (Not getting  
> > Positive and Negative count Separately). It is not filtering
> > 
> > It is getting as
> > 
> > For the samedaterange For Positive.
> > 
> > "createddaterange1" : {  
> > "\_type" : "date\_histogram",  
> > "entries" :   
> > },
> > 
> > For the samedaterange For Negative.. But the count I got here is  
> > the (Combination of Both Positive and Negative)  
> > "createddaterange2" : {  
> > "\_type" : "date\_histogram",  
> > "entries" : [ {  
> > "time" : 1337212800000,  
> > "count" : 34,  
> > "min" : 1.337269645E12,  
> > "max" : 1.33729302E12,  
> > "total" : 4.5467295833E13,  
> > "total\_count" : 34,  
> > "mean" : 1.3372734068529412E12  
> > }, {  
> > "time" : 1337299200000,  
> > "count" : 1,  
> > "min" : 1.33737948E12,  
> > "max" : 1.33737948E12,  
> > "total" : 1.33737948E12,  
> > "total\_count" : 1,  
> > "mean" : 1.33737948E12  
> > },
> > 
> > How can I get the Positive and Negative counts separately?
> > 
> > Thanks!
> > 
> > Cheers!
> > 
> > George!
> > 
> > On May 21, 2:58 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Yes, you can simply add a facet\_filter to it.
> > 
> > > On Sat, May 19, 2012 at 6:32 PM, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com)  
> > > wrote:
> > > 
> > > > Hi,  
> > > > Is there any method to useFacetFilterinDateHistogramFacet?
> > 
> > > > Cheers!
> > 
> > > > George

---

<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:27am UTC](https://discuss.elastic.co/t/how-to-use-filter-in-datehistogram-facet/7775/6 "2017-07-06T03:27:25Z")

</div>


