How to visualize this query in kibana?
POST /teletrain/_search
{
"size": 0,
"aggs": {
"orders_per_hour_of_day": {
"terms": {
"script": {
"lang": "painless",
"source": "doc['ctime'].value.getHour()"
},
"size": 24
},
"aggs": {
"total_orders_per_day_of_week": {
"terms": {
"script": {
"lang": "painless",
"source": "doc['ctime'].value.getDayOfWeekEnum()"
}
},
"aggs": {
"number_of_weeks": {
"date_histogram": {
"field": "ctime",
"calendar_interval": "week"
}
},
"average_orders_per_hour_day_of_week": {
"bucket_script": {
"buckets_path": {
"doc_count": "_count",
"number_of_weeks": "number_of_weeks._bucket_count"
},
"script": "params.doc_count / params.number_of_weeks"
}
}
}
}
}
}
}
}