Would it be possible to add custom keys to aggregations with dateRange?
Now it returns the computed ranges from the query.
Hi.
Could you please elaborate a bit? Do you want to specify the keys in the returned buckets in your query?
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”
},
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:
This issue is fixed in 7.0