# Kibana Discovery tab - distinct / unique the results

**URL:** https://discuss.elastic.co/t/kibana-discovery-tab-distinct-unique-the-results/110045
**Category:** Kibana
**Created:** [December 3, 2017, 12:33pm UTC](https://discuss.elastic.co/t/kibana-discovery-tab-distinct-unique-the-results/110045 "2017-12-03T12:33:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![elad888](https://avatars.discourse-cdn.com/v4/letter/e/58956e/32.png) [@elad888](https://discuss.elastic.co/u/elad888)
#### Post date: [December 3, 2017, 12:33pm UTC](https://discuss.elastic.co/t/kibana-discovery-tab-distinct-unique-the-results/110045/1 "2017-12-03T12:33:10Z")

</div>

Hi  
I would need to distinct my discovery results by customer ID,  
and get all details of each customer latest action/document.  
I am aware that i can get the unique count by using a visualization , BUT it is not enough , I need to get the full document details and there are many different customers : ) .  
Please let me know if there is a way to do what i need  
Thanks

BTW  
My question is similar to the following discussion that was closed before replying completely :

> [@Search data in discover tab, then apply unique count to results](https://discuss.elastic.co/t/search-data-in-discover-tab-then-apply-unique-count-to-results/76466):
>
> I have a saved search in the discover tab that looks like this I am wanting to sort this data based on the unique count of the username field. In this case, because all of the ip's in the data are the same, I want only one record to show. If there were two ip's in that data, I would want only two records to show. Is there a way to build a table this way? I have tried the data table in the visualization tab, and it does allow me to apply a metric that sorts the unique count of the user…

---

<div class="post-metadata">

### Author: ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)
#### Post date: [December 5, 2017, 12:49pm UTC](https://discuss.elastic.co/t/kibana-discovery-tab-distinct-unique-the-results/110045/2 "2017-12-05T12:49:47Z")

</div>

Hi @elad888,

unfortunately the discover app can not perform that transformation, but the "Data Table" visualization can achieve something similar. Just use a "Terms" aggregation on the field identifying your customers (e.g. `customer_id`) to generate the buckets and "Top Hit" aggregations as the metrics (e.g. on the `_source` field).

---

<div class="post-metadata">

### Author: ![elad888](https://avatars.discourse-cdn.com/v4/letter/e/58956e/32.png) [@elad888](https://discuss.elastic.co/u/elad888)
#### Post date: [December 5, 2017, 1:55pm UTC](https://discuss.elastic.co/t/kibana-discovery-tab-distinct-unique-the-results/110045/3 "2017-12-05T13:55:26Z")

</div>

> [@elad888](#):
>
> ould need to distinct my discovery results by customer ID,

Thanks Felix !!

---

<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: [January 2, 2018, 1:56pm UTC](https://discuss.elastic.co/t/kibana-discovery-tab-distinct-unique-the-results/110045/4 "2018-01-02T13:56:05Z")

</div>

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