# Double Aggregation metric visualization

**URL:** https://discuss.elastic.co/t/double-aggregation-metric-visualization/129687
**Category:** Kibana
**Created:** [April 26, 2018, 1:39pm UTC](https://discuss.elastic.co/t/double-aggregation-metric-visualization/129687 "2018-04-26T13:39:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pgprb](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pgprb](https://discuss.elastic.co/u/pgprb)
#### Post date: [April 26, 2018, 1:39pm UTC](https://discuss.elastic.co/t/double-aggregation-metric-visualization/129687/1 "2018-04-26T13:39:18Z")

</div>

Hi there,

I'm new to Kibana and I'm trying to make a metric visualization (for now) based on a query dsl. The query is something like this:

GET idx/\_search  
{  
"aggs": {  
"top\_tags": {  
"terms": {  
"field": "anObjectUUID"  
},  
"aggs": {  
"top\_sales\_hits": {  
"top\_hits": {  
"sort": [  
{ "timestamp": "order": "desc" }  
}  
],  
"size" : 1  
}  
}  
}  
}  
}  
}

Basically I want to get the most recent image of an object and then filter on top of that in the visualizations.

Thank you in advance.  
Cheers

---

<div class="post-metadata">

### Author: ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)
#### Post date: [April 26, 2018, 8:50pm UTC](https://discuss.elastic.co/t/double-aggregation-metric-visualization/129687/2 "2018-04-26T20:50:25Z")

</div>

Hey, should be able to do. Are you having any issues making the visualization?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/2/b2d93eec141184c241f257d1cf551903639a034b.png)

---

<div class="post-metadata">

### Author: ![pgprb](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pgprb](https://discuss.elastic.co/u/pgprb)
#### Post date: [April 27, 2018, 7:31am UTC](https://discuss.elastic.co/t/double-aggregation-metric-visualization/129687/3 "2018-04-27T07:31:54Z")

</div>

Hi @jbudz

Thank you for your answer, I forgot to say that I want to count all occurrences based on a filter.

For instance, I want to have a metric that says that I have 15 trues (filter), being those 15 the most recent version for each object.

I hope this was clear,

Thanks!

---

<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: [May 25, 2018, 7:31am UTC](https://discuss.elastic.co/t/double-aggregation-metric-visualization/129687/4 "2018-05-25T07:31:59Z")

</div>

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