# Date\_histogram facets seem to ignore "size" attribute, and sort the opposite of terms facets

**URL:** <https://discuss.elastic.co/t/date-histogram-facets-seem-to-ignore-size-attribute-and-sort-the-opposite-of-terms-facets/10475>\
**Category:** Elasticsearch\
**Created:** [January 23, 2013, 3:42pm UTC](https://discuss.elastic.co/t/date-histogram-facets-seem-to-ignore-size-attribute-and-sort-the-opposite-of-terms-facets/10475 "2013-01-23T15:42:42Z")\
**Posts on this page:** 2\
**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, 3:42pm UTC](https://discuss.elastic.co/t/date-histogram-facets-seem-to-ignore-size-attribute-and-sort-the-opposite-of-terms-facets/10475/1 "2013-01-23T15:42:42Z")

</div>

I'm seeing two differences between date\_histogram facets and terms facets  
(ES 0.19.8) and I was hoping for a sanity check here to make sure it's not  
a case of pilot-error.

Issue #1: Date\_histogram facets don't respect "size" attribute like terms  
facets do.

Issue #2: Date\_histogram facets do not default to sorting like terms facets  
do, which is to say, by their "count" field, ascending.

Below are two example queries I've used to successfully control the size of  
the terms facet, but not the date\_histogram facet.

# curl -X GET '[http://127.0.0.1:9200/dpla/\_search?pretty](http://127.0.0.1:9200/dpla/_search?pretty)' -d

'{"facets":{"created":{"date\_histogram":{"field":"created","interval":"day","size":1},"global":true,"size":1}},"size":10,"from":0}'

# curl -X GET '[http://127.0.0.1:9200/dpla/\_search?pretty](http://127.0.0.1:9200/dpla/_search?pretty)' -d

'{"facets":{"subject":{"terms":{"field":"type","size":1,"all\_terms":false},"global":true}},"size":10,"from":0}'

So, are these two behaviors by design, bugs, something else?

Thanks!  
-Phunk

--

---

<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:55am UTC](https://discuss.elastic.co/t/date-histogram-facets-seem-to-ignore-size-attribute-and-sort-the-opposite-of-terms-facets/10475/2 "2017-07-06T02:55:01Z")

</div>


