# Unique values on the matching docs

**URL:** <https://discuss.elastic.co/t/unique-values-on-the-matching-docs/21111>\
**Category:** Elasticsearch\
**Created:** [December 5, 2014, 5:13pm UTC](https://discuss.elastic.co/t/unique-values-on-the-matching-docs/21111 "2014-12-05T17:13:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![roger](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@roger](https://discuss.elastic.co/u/roger)\
**Post date:** [December 5, 2014, 5:13pm UTC](https://discuss.elastic.co/t/unique-values-on-the-matching-docs/21111/1 "2014-12-05T17:13:02Z")

</div>

Hello

I have a query with a from/size, and I need to get the unique values of a  
specific field of the returned docs only. I could do it in the client side,  
but it would help if ElasticSearch could do it for me

The Terms Aggregation helps getting the unique values, but it ignores the  
from/size of the query.

Is there a way to run the Terms Aggregation in the results only, or is  
there another way of getting unique values on the search result?

Thanks in advance

Roger

--  
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/CAJp2532diRjvrA-GcM1nNETE7Cuc26HoMBCY6mSJ\_nYs7\_oH%2Bg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJp2532diRjvrA-GcM1nNETE7Cuc26HoMBCY6mSJ_nYs7_oH%2Bg%40mail.gmail.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, 12:45am UTC](https://discuss.elastic.co/t/unique-values-on-the-matching-docs/21111/2 "2017-07-06T00:45:29Z")

</div>


