Custom keys with date range


#1

Would it be possible to add custom keys to aggregations with dateRange?
Now it returns the computed ranges from the query.


#2

Hi.

Could you please elaborate a bit? Do you want to specify the keys in the returned buckets in your query?


#3

Yes, so by passing a key property to my dateRange aggregation I would get
“buckets”: [
{
“key”: “Older than a year”,
“docCount”: 52,
“to”: “2018-01-18T13:01:20.715Z”
},

instead of:
“buckets”: [
{
“key”: “*-18-01-2018”,
“docCount”: 52,
“to”: “2018-01-18T13:01:20.715Z”
},


#4

Hm, from a glance at the code, it seems like its supposed to work with just adding “key” to the aggregation, but a quick test didnt yield any results. I created an issue:


#5

This issue is fixed in 7.0


#6