# Bucket script aggregation

**URL:** https://discuss.elastic.co/t/bucket-script-aggregation/27325
**Category:** Kibana
**Created:** [August 13, 2015, 11:59am UTC](https://discuss.elastic.co/t/bucket-script-aggregation/27325 "2015-08-13T11:59:18Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![alainc](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@alainc](https://discuss.elastic.co/u/alainc)
#### Post date: [January 27, 2016, 9:25pm UTC](https://discuss.elastic.co/t/bucket-script-aggregation/27325/7 "2016-01-27T21:25:26Z")

</div>

Hi,

i was trying also to do something like that inside kibana , that works nice in curl but i saw it's not possible to report it inside Kibana.  
as grouping by day of week is not directly possible.

Any idea to do that without this aggr?

thks

one of th other usage i was thinking of is to compare avearge and max value based on day of the week+hour inside this day to compare to current value

{  
"size": 0,  
"aggs": {  
"perday": {  
"terms": {  
"script": "doc['datedeath'].date.dayOfWeek.value"  
}  
}  
}  
}

---

_[View the full topic](https://discuss.elastic.co/t/bucket-script-aggregation/27325)._
