I have a scenario where a field is of array data type and i need to perform autocomplete.
I have to filter my aggregation results.I am not able to do it for some reason , Attaching my query and results.Please let me know if i can perform this in elastic
Query
```
GET contracts/doc/_search
{
"size":0,
"query":{
"bool":{
"must":{
"match_phrase":{
"commodity_line.autocomplete":"3"
}
}
}
},
"aggs" : {
"vendor_names": {
"filter":{
"term":{
"commodity_line":"3"
}
},
"aggs":{
"names":{
"terms":{
"field":"commodity_line.keyword",
"size":1000
}
}
}
}
}
}
```
Results for aggregation:
aggregations doc_count shows 188 but the buckets have results for all arrays matching 3. How can i filter and just have the ones matching