# Elasticsearch: Parameter "include" isn't case insensitive

**URL:** <https://discuss.elastic.co/t/elasticsearch-parameter-include-isnt-case-insensitive/155015>\
**Category:** Elasticsearch\
**Created:** [November 1, 2018, 12:43pm UTC](https://discuss.elastic.co/t/elasticsearch-parameter-include-isnt-case-insensitive/155015 "2018-11-01T12:43:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandra1](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Alexandra1](https://discuss.elastic.co/u/Alexandra1)\
**Post date:** [November 1, 2018, 12:43pm UTC](https://discuss.elastic.co/t/elasticsearch-parameter-include-isnt-case-insensitive/155015/1 "2018-11-01T12:43:00Z")

</div>

Hello,

How can I configure the index in elasticsearch in order to make the parameter "include" from the aggregation to be case insensitive?

I have this index:

PUT index  
{  
"settings": {  
"analysis": {  
"analyzer": {  
"my\_normalizer": {  
"type": "custom",  
"tokenizer": "keyword",  
"char\_filter": ,  
"filter": ["lowercase"]  
}  
}  
}  
},  
"mappings": {  
"\_doc": {  
"properties": {  
"foo": {  
"type": "text",  
"analyzer": "my\_normalizer",  
"fielddata": true  
}  
}  
}  
}  
}  
With data:  
PUT index/\_doc/1  
{  
"foo": "BAR"  
}

PUT index/\_doc/2  
{  
"foo": "bar"  
}

And the query:  
GET index/\_search  
{  
"size": 0,  
"aggs": {  
"ad":{  
"terms": {"field": "foo",  
"include": "ba.\*"  
}  
}}  
}  
But if i change "ba" in "BA" the aggregation has no result.  
Can you help me?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 1, 2018, 1:00pm UTC](https://discuss.elastic.co/t/elasticsearch-parameter-include-isnt-case-insensitive/155015/2 "2018-11-01T13:00:46Z")

</div>

Don't use a lowercase normalizer may be.

---

<div class="post-metadata">

**Author:** ![Alexandra1](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Alexandra1](https://discuss.elastic.co/u/Alexandra1)\
**Post date:** [November 1, 2018, 1:22pm UTC](https://discuss.elastic.co/t/elasticsearch-parameter-include-isnt-case-insensitive/155015/3 "2018-11-01T13:22:34Z")

</div>

Hi,  
If i don't use a lowercase normalizer the aggregation returns one result with (""include": "ba._"" -bar ) and one result with ("include": "BA._" -BAR). But i want both of the results no matter what i type (ba/BA)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 1, 2018, 1:41pm UTC](https://discuss.elastic.co/t/elasticsearch-parameter-include-isnt-case-insensitive/155015/4 "2018-11-01T13:41:35Z")

</div>

The result you are getting is then ba and not BA. That's why you can't include the later.

---

<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:** [November 29, 2018, 1:41pm UTC](https://discuss.elastic.co/t/elasticsearch-parameter-include-isnt-case-insensitive/155015/5 "2018-11-29T13:41:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
