Distinct value in the query response and not distinct count

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

The query used:

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

The output seen:

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

" SELECT DISTINCT(City) FROM TABLE"


and NOT


"SELECT COUNT(DISTINCT City) FROM TABLE"

Any pointer is highly appreciated.

Thanks

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