# How to do case insensitive search on terms?

**URL:** <https://discuss.elastic.co/t/how-to-do-case-insensitive-search-on-terms/19790>\
**Category:** Elasticsearch\
**Created:** [September 15, 2014, 3:44pm UTC](https://discuss.elastic.co/t/how-to-do-case-insensitive-search-on-terms/19790 "2014-09-15T15:44:54Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [September 15, 2014, 3:47pm UTC](https://discuss.elastic.co/t/how-to-do-case-insensitive-search-on-terms/19790/2 "2014-09-15T15:47:33Z")

</div>

I assume you use the standard analyzer which uses by default a token filter  
"lowercase".

Just use a custom analyzer, without "lowercase" token filter, and you will  
get case-sensitive search.

Jörg

On Mon, Sep 15, 2014 at 5:44 PM, John Smith [java.dev.mtl@gmail.com](mailto:java.dev.mtl@gmail.com) wrote:

> Using ES 1.3.2
> 
> The current application I'm building only uses term queries for exact  
> matches.
> 
> Example query
> 
> "query": {  
> "term": {  
> "logType": "abc"  
> }
> 
> The field logType is pulled from external DB as all caps so for instance  
> ABC
> 
> If i send the query
> 
> "query": {  
> "term": {  
> "logType": "ABC"  
> }
> 
> I get no results.
> 
> If I send the query
> 
> "query": {  
> "term": {  
> "logType": "abc"  
> }
> 
> I get results.
> 
> So does this mean I need to toLower the input before building the query or  
> there's an ES way of doing this?
> 
> Thanks
> 
> --  
> 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/8fec1f56-1a59-4d17-bb01-f2ecd62bfbb4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8fec1f56-1a59-4d17-bb01-f2ecd62bfbb4%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/8fec1f56-1a59-4d17-bb01-f2ecd62bfbb4%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8fec1f56-1a59-4d17-bb01-f2ecd62bfbb4%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> 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/CAKdsXoHi-483Tgf5DmwXEfKrGRye1vjvGU4jFL0o8guNsGBaCw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHi-483Tgf5DmwXEfKrGRye1vjvGU4jFL0o8guNsGBaCw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

_[View the full topic](https://discuss.elastic.co/t/how-to-do-case-insensitive-search-on-terms/19790)._
