# Not\_analyzed impact on terms aggregations

**URL:** <https://discuss.elastic.co/t/not-analyzed-impact-on-terms-aggregations/27755>\
**Category:** Elasticsearch\
**Created:** [August 20, 2015, 11:59am UTC](https://discuss.elastic.co/t/not-analyzed-impact-on-terms-aggregations/27755 "2015-08-20T11:59:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![takwaMissaoui](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@takwaMissaoui](https://discuss.elastic.co/u/takwaMissaoui)\
**Post date:** [August 20, 2015, 11:59am UTC](https://discuss.elastic.co/t/not-analyzed-impact-on-terms-aggregations/27755/1 "2015-08-20T11:59:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [August 21, 2015, 3:27pm UTC](https://discuss.elastic.co/t/not-analyzed-impact-on-terms-aggregations/27755/2 "2015-08-21T15:27:50Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:54pm UTC](https://discuss.elastic.co/t/not-analyzed-impact-on-terms-aggregations/27755/3 "2017-07-05T23:54:34Z")

</div>


