# Gauge ordering by value calculated in bucket script aggregation

**URL:** https://discuss.elastic.co/t/gauge-ordering-by-value-calculated-in-bucket-script-aggregation/327077
**Category:** Kibana
**Created:** [March 6, 2023, 1:07pm UTC](https://discuss.elastic.co/t/gauge-ordering-by-value-calculated-in-bucket-script-aggregation/327077 "2023-03-06T13:07:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tumbl3w33d](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tumbl3w33d/32/118086_2.png) [@tumbl3w33d](https://discuss.elastic.co/u/tumbl3w33d)
#### Post date: [March 6, 2023, 1:07pm UTC](https://discuss.elastic.co/t/gauge-ordering-by-value-calculated-in-bucket-script-aggregation/327077/1 "2023-03-06T13:07:50Z")

</div>

Hello,

I'm using elastic agent with its system integration to collect metrics and I want to display the disk use per host as gauges. It's achieved by calculating the percentual use in a bucket script:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/1/a1b300a4080a43a7dbebbd7ae5f51f482a191d86.png)

The ordering doesn't make much sense because I actually want to sort by the computed value (the percentual use) which makes it comparable between hosts. Like this it just looks random to the enduser.  
Interesting fact - the "Top N" display style for some reason sorts as I would want it but there I don't like that if the top 1 value is 47.7%, the bar fills the entire line which visually suggest something is full, although it's not even filled by half.

I hope I gave the necessary information for you to understand my issue. Kind regards.

Edit: I add a screenshot of the current ordering to give an impression

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/1/917c0741e40abbf34dd3ae5635af9cc85e5dd109.png)

---

<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: [April 3, 2023, 1:08pm UTC](https://discuss.elastic.co/t/gauge-ordering-by-value-calculated-in-bucket-script-aggregation/327077/2 "2023-04-03T13:08:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
