Hi All,
I have a simple requirement to get the aggregated result as per the posted date like documents posted any day, today, less than 7 days, less than 30 days, or greater than 30 days.
I wrote a simple date range query which is returning the result but the doc count is 0. It seems I am missing something.
"aggs": {
"postedDate": {
"date_range": {
"field": "publishDate",
"ranges": [
{
"from": "now-1825d/d",
"to": "now/d",
"key":"Any"
},
{
"from": "now-1d/d",
"to": "now/d",
"key":"Today"
},
{
"from": "now-7d/d",
"to": "now/d",
"key":"LESS_THAN_7"
},
{
"from": "now-30d/d",
"to": "now/d",
"key":"LESS_THAN_30"
},
{
"to": "now-30d/d",
"key":"GREATER_THAN_30"
}
]
}
}
}
Any pointer to write a correct query will be helpful.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.