We have a field category in our index , We want to get number of records for each category using aggregation query.
GET /_search
{
"aggs" : {
"genres" : {
"terms" : { "field" : "category" }
}
}
}
We are getting results but it is giving results after analyzing category. Something like this
{
"key": "chil",
"doc_count": 343503
},
{
"key": "child",
"doc_count": 343503
},
{
"key": "childr",
"doc_count": 343503
},
{
"key": "childre",
"doc_count": 343503
},
But I want results without analyzing, I hope it is possible, Can someone help me with the query.
Expected
{
"key": "children",
"doc_count": 343503
},
{
"key": "Category1",
"doc_count": 43503
},
{
"key": "Category2",
"doc_count": 60000
}
We are having autocomplete analyzer for the field categoryqu in mapping
"name": {
"type": "string",
"analyzer": "autocomplete",
"search_analyzer": "standard"
}
Thanks