I need to group by day in my query, so i'm trying to apply group by with datetime field as below:
{
"_source": "false",
"query": {
"match_all": {}
},
"aggs": {
"group_by_weekday": {
"date_histogram": {
"field": "record_created_at",
"calendar_interval": "day",
"format": "EEEE"
}
}
}
}
But i'm getting the results like below?
{
"aggregations": {
"group_by_weekday": {
"buckets": [
{
"key_as_string": "Tuesday",
"key": 1682380800000,
"doc_count": 13
},
{
"key_as_string": "Wednesday",
"key": 1682467200000,
"doc_count": 0
},
{
"key_as_string": "Thursday",
"key": 1682553600000,
"doc_count": 1
},
{
"key_as_string": "Wednesday",
"key": 1683072000000,
"doc_count": 1
},
{
"key_as_string": "Thursday",
"key": 1683158400000,
"doc_count": 1
}
]
}
}
}
seems like grouping is not being applied here
How can we do this other way to overcome this?