# Changing default analyzers in a Filter Bucket, one for Query-Terms and a different one for Aggregation-Terms

**URL:** <https://discuss.elastic.co/t/changing-default-analyzers-in-a-filter-bucket-one-for-query-terms-and-a-different-one-for-aggregation-terms/39830>\
**Category:** Elasticsearch\
**Created:** [January 21, 2016, 11:24pm UTC](https://discuss.elastic.co/t/changing-default-analyzers-in-a-filter-bucket-one-for-query-terms-and-a-different-one-for-aggregation-terms/39830 "2016-01-21T23:24:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mguillen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mguillen/32/7324_2.png) [@mguillen](https://discuss.elastic.co/u/mguillen)\
**Post date:** [January 21, 2016, 11:24pm UTC](https://discuss.elastic.co/t/changing-default-analyzers-in-a-filter-bucket-one-for-query-terms-and-a-different-one-for-aggregation-terms/39830/1 "2016-01-21T23:24:10Z")

</div>

I have a ElasticSearch index that is dynamically created beginning with a pivot table so having a document with n/dynamic properties and I am trying to set a default analyzer for a query-terms and another for the aggregated documents in the result buckets in ElasticSearch 2.0.0. The default analyzer that I would like to apply to the query is based on ["lowercase","asciifolding"] but I need aggretation results without any analyzer(no lowercase and with accents). **_How can I achieve this?_**

The default analyzer I would like to associate to query is (but it is affecting the aggregation bucket too):  
"index":{  
"analysis": {  
"analyzer":{  
default": {  
"type": "custom",  
"filter": ["lowercase"],  
"tokenizer": "keyword"  
}  
}  
}  
}

My search is this:

{  
"query": {  
"bool": {  
"filter": [  
{  
"term": {  
"type": "autos"  
}  
},  
{  
"terms": {  
"type\_autos\_brand": [  
"acura"  
]  
}  
}  
]  
}  
},  
"aggs": {  
"types": {  
"terms": {  
"field": "type\_autos\_province",  
"size": 1000  
}  
}  
},  
"size": 0  
}

An example of the result bucket (estado de mexico will be Estado de México):

{  
"took": 3,  
"hits": {  
"total": 281,  
"max\_score": 0,  
"hits": []  
},  
"aggregations": {  
"types": {  
"doc\_count\_error\_upper\_bound": 0,  
"sum\_other\_doc\_count": 0,  
"buckets": [  
{  
"key": "estado de méxico",  
"doc\_count": 64  
},  
{  
"key": "distrito federal",  
"doc\_count": 53  
},

---

<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:22pm UTC](https://discuss.elastic.co/t/changing-default-analyzers-in-a-filter-bucket-one-for-query-terms-and-a-different-one-for-aggregation-terms/39830/2 "2017-07-05T23:22:23Z")

</div>

Closed on July 5, 2017, 11:22pm UTC


