I'm trying to perform a terms aggregation on an not_analyzed string fields :
you find bellow the mapping :
{
    "test": {
        "properties": {
            "customerId": {
                "type": "string"
            },
            "status": {
                "type": "string",
                "index": "not_analyzed"
            },
            "erpNumber": {
                "type": "string"
            }
        }
    }
}
testing documents :
{
            "customerId": "customer1",
            "status":"10",
            "erpNumber": "17"   
}
{
            "customerId": "customer2",
            "status":"20",
            "erpNumber": "18"   
}
{
            "customerId": "customer3",
            "status":"30",
            "erpNumber": "17"   
}
the query :
 {
    "aggs": {
        "status": {
            "terms": {
                "field": "status"
            }
        }
    }
}
the problem is that I m getting zero buckets as a result when I use status ( not_analyzed) as terms fields , while with others ( analyzed by default ) it works fine .
Please take a look on that .
Thank you