# Fielddata and date\_histogram aggregation

**URL:** <https://discuss.elastic.co/t/fielddata-and-date-histogram-aggregation/22608>\
**Category:** Elasticsearch\
**Created:** [March 10, 2015, 8:43pm UTC](https://discuss.elastic.co/t/fielddata-and-date-histogram-aggregation/22608 "2015-03-10T20:43:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anant\_Aneja](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@Anant\_Aneja](https://discuss.elastic.co/u/Anant_Aneja)\
**Post date:** [March 10, 2015, 8:43pm UTC](https://discuss.elastic.co/t/fielddata-and-date-histogram-aggregation/22608/1 "2015-03-10T20:43:13Z")

</div>

I was reading up on when ES builds fielddata  
: [https://www.elastic.co/guide/en/elasticsearch/guide/current/fielddata.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/fielddata.html)

A footnote on this page reads 'It is required for any operation that needs  
to look up the value contained in a specific document'.

Would this also be true when building buckets in a date\_histogram  
aggregation ? Date fields are bound to have high cardinalilty so I would  
imagine that if populating fielddata would be counterproductive.

In what cases while building aggregations does the above mentioned pattern  
not apply ?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/846fb94b-d390-434b-bc7f-58885bf477ea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/846fb94b-d390-434b-bc7f-58885bf477ea%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Anant\_Aneja](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@Anant\_Aneja](https://discuss.elastic.co/u/Anant_Aneja)\
**Post date:** [March 10, 2015, 9:09pm UTC](https://discuss.elastic.co/t/fielddata-and-date-histogram-aggregation/22608/2 "2015-03-10T21:09:11Z")

</div>

Ignore the bit about high cardinality.

IMO, the use of fielddata for date\_historgram is counter intuitive, since  
the buckets made a ranges as defined by the grain, and therefore the  
buckets are pre-defined in a sense which means the inverted index should  
itself be sufficient for building the buckets, fielddata is not required.

Is this how a date\_histogram actually behaves under the covers ?

On Tuesday, March 10, 2015 at 1:43:13 PM UTC-7, Anant Aneja wrote:

> I was reading up on when ES builds fielddata :  
> [https://www.elastic.co/guide/en/elasticsearch/guide/current/fielddata.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/fielddata.html)
> 
> A footnote on this page reads 'It is required for any operation that needs  
> to look up the value contained in a specific document'.
> 
> Would this also be true when building buckets in a date\_histogram  
> aggregation ? Date fields are bound to have high cardinalilty so I would  
> imagine that if populating fielddata would be counterproductive.
> 
> In what cases while building aggregations does the above mentioned pattern  
> not apply ?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/fdd817e6-7ac2-49be-862b-947492da2dda%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fdd817e6-7ac2-49be-862b-947492da2dda%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:27am UTC](https://discuss.elastic.co/t/fielddata-and-date-histogram-aggregation/22608/3 "2017-07-06T00:27:32Z")

</div>

Closed on July 6, 2017, 12:27am UTC


