# Elastic Search - display all distinct values of an array

**URL:** <https://discuss.elastic.co/t/elastic-search-display-all-distinct-values-of-an-array/16987>\
**Category:** Elasticsearch\
**Created:** [April 13, 2014, 9:41am UTC](https://discuss.elastic.co/t/elastic-search-display-all-distinct-values-of-an-array/16987 "2014-04-13T09:41:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CC1](https://avatars.discourse-cdn.com/v4/letter/c/9fc348/32.png) [@CC1](https://discuss.elastic.co/u/CC1)\
**Post date:** [April 13, 2014, 9:41am UTC](https://discuss.elastic.co/t/elastic-search-display-all-distinct-values-of-an-array/16987/1 "2014-04-13T09:41:42Z")

</div>

For a field mapped as string I have stored list of strings in the ES index,  
for ex:

subject: ["Scientific Research", "Numerical Analysis", "History of Art"]

I would like to query this field and retrieve the full names of categories  
with their frequency count. What I tried so far with facets:

"query":{  
"match\_all": {}  
},  
"facets":{  
"tag":{  
"terms":{  
"field":"subject"}  
}  
}

is not working as expected because it splits my subject fields into tokens  
and returns me the top most frequent stopwords. How can I get full entries  
ordered by counts for an analyzed field, and not only the top 10, if  
possible? Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b85c18f5-ef9b-46c3-b210-30b68094a477%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b85c18f5-ef9b-46c3-b210-30b68094a477%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:36am UTC](https://discuss.elastic.co/t/elastic-search-display-all-distinct-values-of-an-array/16987/2 "2017-07-06T01:36:11Z")

</div>


