Not_analyzed impact on terms aggregations


(Takwa Missaoui) #1

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


(Adrien Grand) #2

This is weird indeed. Do you have failed shards? If no, can you build a standalone shell script that reproduces the issue (using curl calls)?


(system) #3