# "size" attribute doesn't seem to work with date\_histogram facets

**URL:** <https://discuss.elastic.co/t/size-attribute-doesnt-seem-to-work-with-date-histogram-facets/10478>\
**Category:** Elasticsearch\
**Created:** [January 23, 2013, 5:47pm UTC](https://discuss.elastic.co/t/size-attribute-doesnt-seem-to-work-with-date-histogram-facets/10478 "2013-01-23T17:47:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Phunk\_Gadoury](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@Brian\_Phunk\_Gadoury](https://discuss.elastic.co/u/Brian_Phunk_Gadoury)\
**Post date:** [January 23, 2013, 5:47pm UTC](https://discuss.elastic.co/t/size-attribute-doesnt-seem-to-work-with-date-histogram-facets/10478/1 "2013-01-23T17:47:32Z")

</div>

Is the "size" attribute supposed to work with date\_histogram facets the  
same way it works with terms facets? I can successfully limit the total  
number of terms facets returned by adding a size attribute to my query, but  
that attribute has no affect on date\_histogram facets.

Also, is it by design that date\_histogram facets do not default to sorting  
by count value (like terms facets do) but instead, sort by their time  
value, ascending?

(Also, I posted this topic earlier this morning but Google Groups reports  
"That topic no longer exists." I'm not sure why.)

--

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [January 23, 2013, 5:57pm UTC](https://discuss.elastic.co/t/size-attribute-doesnt-seem-to-work-with-date-histogram-facets/10478/2 "2013-01-23T17:57:27Z")

</div>

You can see the various options by looking at  
the DateHistogramFacetProcessor class

[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacetProcessor.java](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacetProcessor.java)

Size is not supported. The various sorting options (time, count, total) are  
presented here:

[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacet.java#L48](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacet.java#L48)

Cheers,

Ivan

On Wed, Jan 23, 2013 at 9:47 AM, Brian 'Phunk' Gadoury \<  
[bgadoury@endpoint.com](mailto:bgadoury@endpoint.com)\> wrote:

> Is the "size" attribute supposed to work with date\_histogram facets the  
> same way it works with terms facets? I can successfully limit the total  
> number of terms facets returned by adding a size attribute to my query, but  
> that attribute has no affect on date\_histogram facets.
> 
> Also, is it by design that date\_histogram facets do not default to sorting  
> by count value (like terms facets do) but instead, sort by their time  
> value, ascending?
> 
> (Also, I posted this topic earlier this morning but Google Groups reports  
> "That topic no longer exists." I'm not sure why.)
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Brian\_Phunk\_Gadoury](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@Brian\_Phunk\_Gadoury](https://discuss.elastic.co/u/Brian_Phunk_Gadoury)\
**Post date:** [January 23, 2013, 6:33pm UTC](https://discuss.elastic.co/t/size-attribute-doesnt-seem-to-work-with-date-histogram-facets/10478/3 "2013-01-23T18:33:41Z")

</div>

Thank you for the reply, Ivan.

Shortly _after_ I posted this thread, I spotted that the ES documentation  
discusses the size, etc. options for the Terms facet, but not for  
date\_histogram. Whoops.

I guess I'll force the sort option in my queries to get that consistent  
between different facet types. Then I'll just limit the facet count once I  
get the response back from ES.

Thanks again.  
-Phunk

On Wednesday, January 23, 2013 10:57:27 AM UTC-7, Ivan Brusic wrote:

> You can see the various options by looking at  
> the DateHistogramFacetProcessor class
> 
> [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacetProcessor.java](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacetProcessor.java)
> 
> Size is not supported. The various sorting options (time, count, total)  
> are presented here:
> 
> [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacet.java#L48](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacet.java#L48)
> 
> Cheers,
> 
> Ivan
> 
> On Wed, Jan 23, 2013 at 9:47 AM, Brian 'Phunk' Gadoury \<  
> [bgad...@endpoint.com](mailto:bgad...@endpoint.com) \<javascript:\>\> wrote:
> 
> > Is the "size" attribute supposed to work with date\_histogram facets the  
> > same way it works with terms facets? I can successfully limit the total  
> > number of terms facets returned by adding a size attribute to my query, but  
> > that attribute has no affect on date\_histogram facets.
> > 
> > Also, is it by design that date\_histogram facets do not default to  
> > sorting by count value (like terms facets do) but instead, sort by their  
> > time value, ascending?
> > 
> > (Also, I posted this topic earlier this morning but Google Groups reports  
> > "That topic no longer exists." I'm not sure why.)
> > 
> > --

--

---

<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:54am UTC](https://discuss.elastic.co/t/size-attribute-doesnt-seem-to-work-with-date-histogram-facets/10478/4 "2017-07-06T02:54:56Z")

</div>


