# Advice on mapping/searching with lowercase

**URL:** <https://discuss.elastic.co/t/advice-on-mapping-searching-with-lowercase/21727>\
**Category:** Elasticsearch\
**Created:** [January 20, 2015, 8:28am UTC](https://discuss.elastic.co/t/advice-on-mapping-searching-with-lowercase/21727 "2015-01-20T08:28:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maarten\_Roosendaal](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@Maarten\_Roosendaal](https://discuss.elastic.co/u/Maarten_Roosendaal)\
**Post date:** [January 20, 2015, 8:28am UTC](https://discuss.elastic.co/t/advice-on-mapping-searching-with-lowercase/21727/1 "2015-01-20T08:28:57Z")

</div>

Hi,

I'm trying to figure out the correct mapping for searching for exact values  
but lowercased. I thought this would work:  
....  
"exact\_lowercase": {  
"filter": [  
"lowercase"  
],  
"type": "custom",  
"tokenizer": "keyword"  
}  
......

and the mapping of the field:  
"TITLE": {  
"fields": {  
"exact\_lowercase": {  
"search\_analyzer": "keyword",  
"index\_analyzer": "exact\_lowercase",  
"type": "string"  
},  
...some other mapping....  
},  
"type": "multi\_field"  
}

but when i do a termquery or query\_string query i'm not getting any hits,  
for example "steel wheels". The original value: "Steel Wheels". What am i  
doing wrong. The idea for the searchstrategy is to first match on exact  
lowercase strings, if nothing is found we do a partial match.

Thanks,  
Maarten

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/27936be4-3c41-4837-bdd4-01e765d7aa3c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/27936be4-3c41-4837-bdd4-01e765d7aa3c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [January 20, 2015, 8:40am UTC](https://discuss.elastic.co/t/advice-on-mapping-searching-with-lowercase/21727/2 "2015-01-20T08:40:13Z")

</div>

At index time, you are using your exact\_lowercase analyzer. "Steel Wheels" is indexed as "steel wheels".

When searching for "steel wheels" it obviously does not match.

Why not using the same analyzer at search and index time?

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 20 janv. 2015 à 09:28, Maarten Roosendaal [mroosendaal14@gmail.com](mailto:mroosendaal14@gmail.com) a écrit :
> 
> Hi,
> 
> I'm trying to figure out the correct mapping for searching for exact values but lowercased. I thought this would work:  
> ....  
> "exact\_lowercase": {  
> "filter": [  
> "lowercase"  
> ],  
> "type": "custom",  
> "tokenizer": "keyword"  
> }  
> ......
> 
> and the mapping of the field:  
> "TITLE": {  
> "fields": {  
> "exact\_lowercase": {  
> "search\_analyzer": "keyword",  
> "index\_analyzer": "exact\_lowercase",  
> "type": "string"  
> },  
> ...some other mapping....  
> },  
> "type": "multi\_field"  
> }
> 
> but when i do a termquery or query\_string query i'm not getting any hits, for example "steel wheels". The original value: "Steel Wheels". What am i doing wrong. The idea for the searchstrategy is to first match on exact lowercase strings, if nothing is found we do a partial match.
> 
> ## Thanks, Maarten
> 
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/27936be4-3c41-4837-bdd4-01e765d7aa3c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/27936be4-3c41-4837-bdd4-01e765d7aa3c%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/81D6E9F6-F61B-4AB2-B9D1-40E601F77C13%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/81D6E9F6-F61B-4AB2-B9D1-40E601F77C13%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:37am UTC](https://discuss.elastic.co/t/advice-on-mapping-searching-with-lowercase/21727/3 "2017-07-06T00:37:50Z")

</div>


