# Distinct values from field(s)

**URL:** <https://discuss.elastic.co/t/distinct-values-from-field-s/167304>\
**Category:** Elasticsearch\
**Created:** [February 6, 2019, 2:44pm UTC](https://discuss.elastic.co/t/distinct-values-from-field-s/167304 "2019-02-06T14:44:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![srikanthkadem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srikanthkadem/32/40018_2.png) [@srikanthkadem](https://discuss.elastic.co/u/srikanthkadem)\
**Post date:** [February 6, 2019, 2:44pm UTC](https://discuss.elastic.co/t/distinct-values-from-field-s/167304/1 "2019-02-06T14:44:13Z")

</div>

Can anyone help to get distinct values from ES data fields. I have a column with index setting as below  
"ItemType": {

- "type": "text",
- "fields": {
  - "keyword": {
    - "ignore\_above": 256,
    - "type": "keyword"}  
I tried to do Aggregation on itemtype directly but I was facing issue as it is text field.  
then I tried with itemtype.keyword then response was valid but 0 records.  
below is the code (using NEST)  
var res = client.Search\<Dictionary\<string,object\>\>(s =\> s.Index("jobs").Aggregations(  
a =\> a.Terms("ItemTypeagg", ag =\> ag.Field("itemtype.keyword")  
.Size(1000))));  
var data= res.Aggregations.Terms("ItemTypeagg");  
Can someone help with ES query so that I can make changes in Nest code.

---

<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:** [March 6, 2019, 2:44pm UTC](https://discuss.elastic.co/t/distinct-values-from-field-s/167304/2 "2019-03-06T14:44:14Z")

</div>

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