# Select distinct objects

**URL:** <https://discuss.elastic.co/t/select-distinct-objects/158917>\
**Category:** Elasticsearch\
**Created:** [November 30, 2018, 2:40pm UTC](https://discuss.elastic.co/t/select-distinct-objects/158917 "2018-11-30T14:40:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hichem\_Noomeni](https://avatars.discourse-cdn.com/v4/letter/h/e47774/32.png) [@Hichem\_Noomeni](https://discuss.elastic.co/u/Hichem_Noomeni)\
**Post date:** [November 30, 2018, 2:40pm UTC](https://discuss.elastic.co/t/select-distinct-objects/158917/1 "2018-11-30T14:40:53Z")

</div>

Hello everyone,

I have mapping that contains fileds like this  
{  
"team.id" : {"type": "long"},  
"team.value" : {"type" : "text"} with keyword of course.  
}

I may have documents with different team.id but same team.value.  
How can I look for distinct objects (distincts team.id ) and return the whole object team.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 30, 2018, 4:53pm UTC](https://discuss.elastic.co/t/select-distinct-objects/158917/2 "2018-11-30T16:53:09Z")

</div>

I _think_ you are looking for either field [collapsing](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-collapse.html) or the [terms](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html) aggregation.

---

<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:** [December 28, 2018, 4:53pm UTC](https://discuss.elastic.co/t/select-distinct-objects/158917/3 "2018-12-28T16:53:20Z")

</div>

Closed on December 28, 2018, 4:53pm UTC

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