# Make a count on a list of values

**URL:** <https://discuss.elastic.co/t/make-a-count-on-a-list-of-values/203868>\
**Category:** Elasticsearch\
**Created:** [October 16, 2019, 2:58pm UTC](https://discuss.elastic.co/t/make-a-count-on-a-list-of-values/203868 "2019-10-16T14:58:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alon\_Goldenberg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alon_goldenberg/32/58491_2.png) [@Alon\_Goldenberg](https://discuss.elastic.co/u/Alon_Goldenberg)\
**Post date:** [October 16, 2019, 2:58pm UTC](https://discuss.elastic.co/t/make-a-count-on-a-list-of-values/203868/1 "2019-10-16T14:58:24Z")

</div>

Hello,

I want to create a query that will count the appearance of every value in a list of values.

example:

each line represents a different doc:

|doc\_id|Name|  
|1|Sam|  
|2|Dan|  
|3|Sam|  
|4|Sam|  
|5|Billy|  
|6|Billy|  
|7|John|

and I have the following list - [John, Billy, Sam]  
I want the output to be:

|John|1|  
|Billy|2|  
|Sam|3|

Is this possible?

Alon

---

<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:** [November 13, 2019, 2:58pm UTC](https://discuss.elastic.co/t/make-a-count-on-a-list-of-values/203868/2 "2019-11-13T14:58:31Z")

</div>

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