# Grouped country wise record then i want to get maximum value from each country and id

**URL:** <https://discuss.elastic.co/t/grouped-country-wise-record-then-i-want-to-get-maximum-value-from-each-country-and-id/232342>\
**Category:** Elasticsearch\
**Created:** [May 13, 2020, 2:29am UTC](https://discuss.elastic.co/t/grouped-country-wise-record-then-i-want-to-get-maximum-value-from-each-country-and-id/232342 "2020-05-13T02:29:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [May 13, 2020, 2:29am UTC](https://discuss.elastic.co/t/grouped-country-wise-record-then-i-want-to-get-maximum-value-from-each-country-and-id/232342/1 "2020-05-13T02:29:38Z")

</div>

{

```
"aggs" : {
    "country_groups" : {
        "terms" : { "field" : "country.keyword",
        		"size":30000
        },
      "aggs":{
			"max_price":{
	        "max": { "field" : "video_count"}
	       }
}
}
}

```

}

---

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [May 13, 2020, 2:30am UTC](https://discuss.elastic.co/t/grouped-country-wise-record-then-i-want-to-get-maximum-value-from-each-country-and-id/232342/2 "2020-05-13T02:30:31Z")

</div>

i want to get each maximum record id

---

<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:** [June 10, 2020, 2:36am UTC](https://discuss.elastic.co/t/grouped-country-wise-record-then-i-want-to-get-maximum-value-from-each-country-and-id/232342/3 "2020-06-10T02:36:07Z")

</div>

Closed on June 10, 2020, 2:36am UTC

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