# Multiple max aggs for last months

**URL:** <https://discuss.elastic.co/t/multiple-max-aggs-for-last-months/268639>\
**Category:** Elasticsearch\
**Created:** [March 29, 2021, 9:18am UTC](https://discuss.elastic.co/t/multiple-max-aggs-for-last-months/268639 "2021-03-29T09:18:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pbroek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pbroek/32/69990_2.png) [@pbroek](https://discuss.elastic.co/u/pbroek)\
**Post date:** [March 29, 2021, 9:18am UTC](https://discuss.elastic.co/t/multiple-max-aggs-for-last-months/268639/1 "2021-03-29T09:18:27Z")

</div>

Hi,

I am struggling with the query to search for 2 max values, mag and depth, over the last day or so.  
I have read in the topics here but cannot find the solution.

Any help is appreciated.

This portion works, but if I add another aggs max I get errors.

GET earthquakes/\_search  
{  
"size": 0,  
"query": {  
"bool": {  
"must": [  
{  
"range": {  
"@timestamp": {  
"gte": "now-1d/d"  
}  
}  
}  
]  
}  
},  
"aggs": {  
"max\_mag": {  
"max": {  
"field": "mag"  
}  
}  
}  
}

---

<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 26, 2021, 9:18am UTC](https://discuss.elastic.co/t/multiple-max-aggs-for-last-months/268639/2 "2021-04-26T09:18:54Z")

</div>

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