# How get distinct value in returned buckets

**URL:** <https://discuss.elastic.co/t/how-get-distinct-value-in-returned-buckets/191200>\
**Category:** Elasticsearch\
**Created:** [July 18, 2019, 12:56pm UTC](https://discuss.elastic.co/t/how-get-distinct-value-in-returned-buckets/191200 "2019-07-18T12:56:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmet\_Kartal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmet_kartal/32/47196_2.png) [@Ahmet\_Kartal](https://discuss.elastic.co/u/Ahmet_Kartal)\
**Post date:** [July 18, 2019, 12:56pm UTC](https://discuss.elastic.co/t/how-get-distinct-value-in-returned-buckets/191200/1 "2019-07-18T12:56:50Z")

</div>

```
"Group3": {
                  "buckets": [
                    {
                      "doc_count": 1, 
                      "key": "sleep"
                    }
                  ], 
                  "doc_count_error_upper_bound": 0, 
                  "sum_other_doc_count": 0
                }, 
                "doc_count": 56, 
                "key": 18
              }, 
              {
                "Group3": {
                  "buckets": [
                    {
                      "doc_count": 1, 
                      "key": "sleep"
                    }
                  ], 
                  "doc_count_error_upper_bound": 0, 
                  "sum_other_doc_count": 0
                }, 
                "doc_count": 58, 
                "key": 17
              }, 
              {
                "Group3": {
                  "buckets": [
                    {
                      "doc_count": 1, 
                      "key": "a"
                    }, 
                    {
                      "doc_count": 1, 
                      "key": "sleep"
                    }
                  ], 
                  "doc_count_error_upper_bound": 0, 
                  "sum_other_doc_count": 0
                }, 
                "doc_count": 60, 
                "key": 16
              }, 
              {
                "Group3": {
                  "buckets": [
                    {
                      "doc_count": 1, 
                      "key": "a"
                    }, 
                    {
                      "doc_count": 1, 
                      "key": "sleep"
                    }
                  ], 
                  "doc_count_error_upper_bound": 0, 
                  "sum_other_doc_count": 0
                }, 
                "doc_count": 64, 
                "key": 15
              }, 

```

I want to make a query that will make distinct them. What I want is in "key": 19 part I want to see "sleep" data but I don't want to see "sleep" data in "key":18 again. Or I want to see "a" data in "key":15 part and I don't want to see "a" data again anywhere. How can I do that? Can you give me some tips?

---

<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:** [August 15, 2019, 12:56pm UTC](https://discuss.elastic.co/t/how-get-distinct-value-in-returned-buckets/191200/2 "2019-08-15T12:56:52Z")

</div>

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