# Aggregation with max field value

**URL:** https://discuss.elastic.co/t/aggregation-with-max-field-value/341723
**Category:** Kibana
**Created:** [August 25, 2023, 11:22pm UTC](https://discuss.elastic.co/t/aggregation-with-max-field-value/341723 "2023-08-25T23:22:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Mauricio\_Castrillon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauricio_castrillon/32/124984_2.png) [@Mauricio\_Castrillon](https://discuss.elastic.co/u/Mauricio_Castrillon)
#### Post date: [August 25, 2023, 11:22pm UTC](https://discuss.elastic.co/t/aggregation-with-max-field-value/341723/1 "2023-08-25T23:22:00Z")

</div>

Hello,  
I'm trying to create a metric in Kibana for a dashboard with some information from servers. The main idea is to have the total amount of objects by location. The challenge is, in each location, I have a certain number of servers, and each server registers its objects amount multiple times by hour, so I need only the last size recorded by each server in a location and make the aggregation of it.  
I would appreciate it if you could help me with any idea on how to make this.

---

<div class="post-metadata">

### Author: ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)
#### Post date: [September 4, 2023, 3:50pm UTC](https://discuss.elastic.co/t/aggregation-with-max-field-value/341723/2 "2023-09-04T15:50:22Z")

</div>

hi @Mauricio_Castrillon welcome to our community.

Maybe you could run a transform to keep on a separate index just the latest document and then work with that.

> **[Transform overview | Elasticsearch Guide \[8.9\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/transform-overview.html#latest-transform-overview)**

---

<div class="post-metadata">

### Author: ![Mauricio\_Castrillon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauricio_castrillon/32/124984_2.png) [@Mauricio\_Castrillon](https://discuss.elastic.co/u/Mauricio_Castrillon)
#### Post date: [September 5, 2023, 4:24pm UTC](https://discuss.elastic.co/t/aggregation-with-max-field-value/341723/3 "2023-09-05T16:24:57Z")

</div>

Hi @jsanz , Thank you for your answer! I'll take a look at the article you shared with me.

---

<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: [October 3, 2023, 4:25pm UTC](https://discuss.elastic.co/t/aggregation-with-max-field-value/341723/4 "2023-10-03T16:25:03Z")

</div>

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