How to make Elasticsearch date_histogram work like this:
{
"aggs": {
"age_range": {
"date_histogram": {
"field": "birthdate",
"interval": "5y"
}
}
}
}
This is a known issue in elasticsearch, you can use either 260 weeks(260w) or 1825 days(1825d) (you can consider leap year if you want).
This will work
{
"size": 0,
"aggs": {
"NAME": {
"date_histogram": {
"field": "birthdate",
"interval": "1825d"
}
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.