# Number of identical documents?

**URL:** <https://discuss.elastic.co/t/number-of-identical-documents/123335>\
**Category:** Elasticsearch\
**Created:** [March 9, 2018, 7:57pm UTC](https://discuss.elastic.co/t/number-of-identical-documents/123335 "2018-03-09T19:57:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevT](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@DevT](https://discuss.elastic.co/u/DevT)\
**Post date:** [March 9, 2018, 7:57pm UTC](https://discuss.elastic.co/t/number-of-identical-documents/123335/1 "2018-03-09T19:57:45Z")

</div>

Let's say I have an index with 50 documents that contain 5 different names. Is there a way to list the number of repeated names in descending order?

For example:  
{  
"John": 19,  
"David": 17,  
"Susan": 7,  
"Peter": 4,  
"Amy": 3  
}

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 9, 2018, 8:26pm UTC](https://discuss.elastic.co/t/number-of-identical-documents/123335/2 "2018-03-09T20:26:55Z")

</div>

A terms aggregation is probably what you want.

---

<div class="post-metadata">

**Author:** ![DevT](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@DevT](https://discuss.elastic.co/u/DevT)\
**Post date:** [March 9, 2018, 8:27pm UTC](https://discuss.elastic.co/t/number-of-identical-documents/123335/3 "2018-03-09T20:27:39Z")

</div>

thank you, I will look into it.

---

<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 6, 2018, 8:27pm UTC](https://discuss.elastic.co/t/number-of-identical-documents/123335/4 "2018-04-06T20:27:53Z")

</div>

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