Suchergebnisse mit Tag „aggregation“


Elasticsearch date_histogram by age from of date of birth

Databases (and search engines like Elasticsearch) typically store the date of birth instead of the current age. It's a simple date value instead of a calculated one which must be maintained every day. But statistics often should contain the age - which is much more pleasant for humans than the date (or year) of birth. This post shows an easy way to use the Elasticsearch date_histogram aggregation to output age buckets instead of counting users by their year of birth.