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.
- "keyword": {