# 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:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Hornov](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@Hornov](https://discuss.elastic.co/u/Hornov)
#### Post date: [August 13, 2015, 11:59am UTC](https://discuss.elastic.co/t/bucket-script-aggregation/27325/1 "2015-08-13T11:59:18Z")

</div>

I'd like to know if it's possible to use bucket script aggregation in kibana.  
Dynamic scripting is disable in my configuration of elasticsearch, so I use script files.

If this functionnality is not yet available can I divide a count by an other (on a different filter) with an other means ?

---

<div class="post-metadata">

### Author: ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)
#### Post date: [August 13, 2015, 4:50pm UTC](https://discuss.elastic.co/t/bucket-script-aggregation/27325/2 "2015-08-13T16:50:34Z")

</div>

You can't use scripted aggregation directly in Kibana at this time. Scripting only allows you to provide scripted input into supported aggregations.

Out of curiosity, what would you like to use scripted aggregation for?

---

<div class="post-metadata">

### Author: ![Hornov](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@Hornov](https://discuss.elastic.co/u/Hornov)
#### Post date: [August 14, 2015, 9:04am UTC](https://discuss.elastic.co/t/bucket-script-aggregation/27325/3 "2015-08-14T09:04:27Z")

</div>

Thanks.  
I'd like to determine when the turnover by sale point decreases.  
So I need to compare 2 agregates.

---

<div class="post-metadata">

### Author: ![Hornov](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@Hornov](https://discuss.elastic.co/u/Hornov)
#### Post date: [August 20, 2015, 9:35am UTC](https://discuss.elastic.co/t/bucket-script-aggregation/27325/4 "2015-08-20T09:35:53Z")

</div>

I'd also like to visualize evolution of (number of connections / number of points of sale)

---

<div class="post-metadata">

### Author: ![denisE](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denisE](https://discuss.elastic.co/u/denisE)
#### Post date: [January 21, 2016, 8:08pm UTC](https://discuss.elastic.co/t/bucket-script-aggregation/27325/5 "2016-01-21T20:08:14Z")

</div>

There are no plans to add this functionality?

---

<div class="post-metadata">

### Author: ![Hornov](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@Hornov](https://discuss.elastic.co/u/Hornov)
#### Post date: [January 22, 2016, 9:10am UTC](https://discuss.elastic.co/t/bucket-script-aggregation/27325/6 "2016-01-22T09:10:52Z")

</div>

I look forward to, but apparently not yet, you could follow [https://github.com/elastic/kibana/issues/4584](https://github.com/elastic/kibana/issues/4584) for updates.

---

<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"  
}  
}  
}  
}

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:04pm UTC](https://discuss.elastic.co/t/bucket-script-aggregation/27325/8 "2017-07-06T14:04:08Z")

</div>


