# Distinct value in the query response and not distinct count

**URL:** <https://discuss.elastic.co/t/distinct-value-in-the-query-response-and-not-distinct-count/84917>\
**Category:** Elasticsearch\
**Created:** [May 8, 2017, 10:41am UTC](https://discuss.elastic.co/t/distinct-value-in-the-query-response-and-not-distinct-count/84917 "2017-05-08T10:41:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jai\_Prakash\_Bhardwaj](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@Jai\_Prakash\_Bhardwaj](https://discuss.elastic.co/u/Jai_Prakash_Bhardwaj)\
**Post date:** [May 8, 2017, 10:41am UTC](https://discuss.elastic.co/t/distinct-value-in-the-query-response-and-not-distinct-count/84917/1 "2017-05-08T10:41:01Z")

</div>

I have a use case of getting distinct Values in output, A brief description of the problem is:

The query used:

```auto
GET/index_name/type_name/_search
{
    "aggs" : {
        "Country" : {
            "terms" : { 
                "field" : "location.City.keyword",
                "size": 10
            }
        }
    }
}

```

The output seen:

```auto
 "aggregations": {
    "Country": {
      "doc_count_error_upper_bound": 10,
      "sum_other_doc_count": 878,
      "buckets": [
     {
          "key": "PICO RIVERA",
          "doc_count": 8
        },
        {
          "key": "SAVANNAH",
          "doc_count": 8
        }
      ]
    }
  }
}

```

Now, what I expect is:  
this result coming in source value, so that I can process it in the UI; I dont require the count at all, just the distinct value.

```auto
" SELECT DISTINCT(City) FROM TABLE"

and NOT

"SELECT COUNT(DISTINCT City) FROM TABLE"

```

Any pointer is highly appreciated.

Thanks

---

<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:** [June 5, 2017, 10:50am UTC](https://discuss.elastic.co/t/distinct-value-in-the-query-response-and-not-distinct-count/84917/2 "2017-06-05T10:50:16Z")

</div>

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