# Fetch distinct values in a nested type field in elasticsearch? Can anyone provide one example?

**URL:** <https://discuss.elastic.co/t/fetch-distinct-values-in-a-nested-type-field-in-elasticsearch-can-anyone-provide-one-example/238426>\
**Category:** Elasticsearch\
**Created:** [June 24, 2020, 9:48am UTC](https://discuss.elastic.co/t/fetch-distinct-values-in-a-nested-type-field-in-elasticsearch-can-anyone-provide-one-example/238426 "2020-06-24T09:48:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![divya005](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@divya005](https://discuss.elastic.co/u/divya005)\
**Post date:** [June 24, 2020, 9:48am UTC](https://discuss.elastic.co/t/fetch-distinct-values-in-a-nested-type-field-in-elasticsearch-can-anyone-provide-one-example/238426/1 "2020-06-24T09:48:50Z")

</div>

{  
"aggs" : {  
"groupBatches" : {  
"nested": {  
"path": "admin"  
},  
"aggs" : {  
"batches" : {  
"terms" : {"field" : "admin.ids.batchId"}  
}  
}  
}  
}  
}  
This is i got from 1 link but my requirement is same can anybody help 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:** [July 22, 2020, 9:48am UTC](https://discuss.elastic.co/t/fetch-distinct-values-in-a-nested-type-field-in-elasticsearch-can-anyone-provide-one-example/238426/2 "2020-07-22T09:48:53Z")

</div>

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