How get distinct value in returned buckets

"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?

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