# Possible to lowercase filter \_index and \_id fields

**URL:** https://discuss.elastic.co/t/possible-to-lowercase-filter--index-and--id-fields/3345
**Category:** Elasticsearch
**Created:** [September 17, 2010, 5:11pm UTC](https://discuss.elastic.co/t/possible-to-lowercase-filter--index-and--id-fields/3345 "2010-09-17T17:11:37Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)
#### Post date: [September 17, 2010, 5:11pm UTC](https://discuss.elastic.co/t/possible-to-lowercase-filter--index-and--id-fields/3345/1 "2010-09-17T17:11:37Z")

</div>

I like that the internal \_index and \_id fields are available to search  
on. However, I am moving from a domain where we could do case  
insensitive searches on these fields. In order to do this, I am trying  
to add a lowercase filter analyzer on these fields, but with no luck.

After creating the index, I have tried the following:

curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping](http://localhost:9201/twitter/tweet/_mapping)' -d '  
{  
"tweet" : {  
"\_index" : { "enabled" : true, "analyzer" : "lowercase" }  
}  
}  
'  
curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping](http://localhost:9201/twitter/tweet/_mapping)' -d '  
{  
"tweet" : {  
"\_index" : { "enabled" : true },  
"properties" : {  
"\_index" : {"type" : "string", "analyzer" :  
"sortable\_tokenizer" }  
}  
}  
}  
'

Neither seem to work.

If analysis is not available on \_id/\_index fields, not the a big deal,  
I just need to disable the ES built in ones and add use my own.

Thanks,  
Paul

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [September 17, 2010, 5:18pm UTC](https://discuss.elastic.co/t/possible-to-lowercase-filter--index-and--id-fields/3345/2 "2010-09-17T17:18:50Z")

</div>

Hi, yea, those are not analyzed and you can't control it (intentionally,  
since analysis is can potentially break it up to more than a single term).

On Fri, Sep 17, 2010 at 7:11 PM, Paul [ppearcy@gmail.com](mailto:ppearcy@gmail.com) wrote:

> I like that the internal \_index and \_id fields are available to search  
> on. However, I am moving from a domain where we could do case  
> insensitive searches on these fields. In order to do this, I am trying  
> to add a lowercase filter analyzer on these fields, but with no luck.
> 
> After creating the index, I have tried the following:
> 
> curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping](http://localhost:9201/twitter/tweet/_mapping)' -d '  
> {  
> "tweet" : {  
> "\_index" : { "enabled" : true, "analyzer" : "lowercase" }  
> }  
> }  
> '  
> curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping](http://localhost:9201/twitter/tweet/_mapping)' -d '  
> {  
> "tweet" : {  
> "\_index" : { "enabled" : true },  
> "properties" : {  
> "\_index" : {"type" : "string", "analyzer" :  
> "sortable\_tokenizer" }  
> }  
> }  
> }  
> '
> 
> Neither seem to work.
> 
> If analysis is not available on \_id/\_index fields, not the a big deal,  
> I just need to disable the ES built in ones and add use my own.
> 
> Thanks,  
> Paul

---

<div class="post-metadata">

### Author: ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)
#### Post date: [September 17, 2010, 5:33pm UTC](https://discuss.elastic.co/t/possible-to-lowercase-filter--index-and--id-fields/3345/3 "2010-09-17T17:33:47Z")

</div>

Cool, thx.

Will create my own versions.

On Sep 17, 11:18 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Hi, yea, those are not analyzed and you can't control it (intentionally,  
> since analysis is can potentially break it up to more than a single term).
> 
> On Fri, Sep 17, 2010 at 7:11 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> 
> > I like that the internal \_index and \_id fields are available to search  
> > on. However, I am moving from a domain where we could do case  
> > insensitive searches on these fields. In order to do this, I am trying  
> > to add a lowercase filter analyzer on these fields, but with no luck.
> 
> > After creating the index, I have tried the following:
> 
> > curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping'-d](http://localhost:9201/twitter/tweet/_mapping'-d) '  
> > {  
> > "tweet" : {  
> > "\_index" : { "enabled" : true, "analyzer" : "lowercase" }  
> > }  
> > }  
> > '  
> > curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping'-d](http://localhost:9201/twitter/tweet/_mapping'-d) '  
> > {  
> > "tweet" : {  
> > "\_index" : { "enabled" : true },  
> > "properties" : {  
> > "\_index" : {"type" : "string", "analyzer" :  
> > "sortable\_tokenizer" }  
> > }  
> > }  
> > }  
> > '
> 
> > Neither seem to work.
> 
> > If analysis is not available on \_id/\_index fields, not the a big deal,  
> > I just need to disable the ES built in ones and add use my own.
> 
> > Thanks,  
> > Paul

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [September 17, 2010, 5:35pm UTC](https://discuss.elastic.co/t/possible-to-lowercase-filter--index-and--id-fields/3345/4 "2010-09-17T17:35:01Z")

</div>

Why not lowercase before hand, so you won't store extra data in the index?

On Fri, Sep 17, 2010 at 7:33 PM, Paul [ppearcy@gmail.com](mailto:ppearcy@gmail.com) wrote:

> Cool, thx.
> 
> Will create my own versions.
> 
> On Sep 17, 11:18 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Hi, yea, those are not analyzed and you can't control it (intentionally,  
> > since analysis is can potentially break it up to more than a single  
> > term).
> > 
> > On Fri, Sep 17, 2010 at 7:11 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> > 
> > > I like that the internal \_index and \_id fields are available to search  
> > > on. However, I am moving from a domain where we could do case  
> > > insensitive searches on these fields. In order to do this, I am trying  
> > > to add a lowercase filter analyzer on these fields, but with no luck.
> > 
> > > After creating the index, I have tried the following:
> > 
> > > curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping'-d](http://localhost:9201/twitter/tweet/_mapping'-d) '  
> > > {  
> > > "tweet" : {  
> > > "\_index" : { "enabled" : true, "analyzer" : "lowercase" }  
> > > }  
> > > }  
> > > '  
> > > curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping'-d](http://localhost:9201/twitter/tweet/_mapping'-d) '  
> > > {  
> > > "tweet" : {  
> > > "\_index" : { "enabled" : true },  
> > > "properties" : {  
> > > "\_index" : {"type" : "string", "analyzer" :  
> > > "sortable\_tokenizer" }  
> > > }  
> > > }  
> > > }  
> > > '
> > 
> > > Neither seem to work.
> > 
> > > If analysis is not available on \_id/\_index fields, not the a big deal,  
> > > I just need to disable the ES built in ones and add use my own.
> > 
> > > Thanks,  
> > > Paul

---

<div class="post-metadata">

### Author: ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)
#### Post date: [September 17, 2010, 7:23pm UTC](https://discuss.elastic.co/t/possible-to-lowercase-filter--index-and--id-fields/3345/5 "2010-09-17T19:23:59Z")

</div>

I'd like to keep the searches on id and index case insensitive to  
avoid any confusion and map as closely to the system we are  
replacing.

So, the two alternatives are:

- Lower case on the indexing side and on the search side
- Add lowercase keyword analyzer and have my own versions of these  
fields

If I then wanted to do case sensitive searches, I would need to add  
logic to the search side lower casing to only target specific fields,  
which gets a little ugly.

The extra \_id field (no way to disable this and \_type, right?) adds a  
little extra bloat to the index, but I'll take it to get the search  
case-insensitive.

Maybe it makes sense to allow a filter to be applied to the internal  
queryable fields?

Thanks,  
Paul

On Sep 17, 11:35 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Why not lowercase before hand, so you won't store extra data in the index?
> 
> On Fri, Sep 17, 2010 at 7:33 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> 
> > Cool, thx.
> 
> > Will create my own versions.
> 
> > On Sep 17, 11:18 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > Hi, yea, those are not analyzed and you can't control it (intentionally,  
> > > since analysis is can potentially break it up to more than a single  
> > > term).
> 
> > > On Fri, Sep 17, 2010 at 7:11 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> > > 
> > > > I like that the internal \_index and \_id fields are available to search  
> > > > on. However, I am moving from a domain where we could do case  
> > > > insensitive searches on these fields. In order to do this, I am trying  
> > > > to add a lowercase filter analyzer on these fields, but with no luck.
> 
> > > > After creating the index, I have tried the following:
> 
> > > > curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping'-d'](http://localhost:9201/twitter/tweet/_mapping'-d')  
> > > > {  
> > > > "tweet" : {  
> > > > "\_index" : { "enabled" : true, "analyzer" : "lowercase" }  
> > > > }  
> > > > }  
> > > > '  
> > > > curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping'-d'](http://localhost:9201/twitter/tweet/_mapping'-d')  
> > > > {  
> > > > "tweet" : {  
> > > > "\_index" : { "enabled" : true },  
> > > > "properties" : {  
> > > > "\_index" : {"type" : "string", "analyzer" :  
> > > > "sortable\_tokenizer" }  
> > > > }  
> > > > }  
> > > > }  
> > > > '
> 
> > > > Neither seem to work.
> 
> > > > If analysis is not available on \_id/\_index fields, not the a big deal,  
> > > > I just need to disable the ES built in ones and add use my own.
> 
> > > > Thanks,  
> > > > Paul

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [September 17, 2010, 7:26pm UTC](https://discuss.elastic.co/t/possible-to-lowercase-filter--index-and--id-fields/3345/6 "2010-09-17T19:26:46Z")

</div>

The \_id and \_type are required. I understand what you are trying to do, in  
this case, I suggest you go with adding two fields lowercasing it.

On Fri, Sep 17, 2010 at 9:23 PM, Paul [ppearcy@gmail.com](mailto:ppearcy@gmail.com) wrote:

> I'd like to keep the searches on id and index case insensitive to  
> avoid any confusion and map as closely to the system we are  
> replacing.
> 
> So, the two alternatives are:
> 
> - Lower case on the indexing side and on the search side
> - Add lowercase keyword analyzer and have my own versions of these  
> fields
> 
> If I then wanted to do case sensitive searches, I would need to add  
> logic to the search side lower casing to only target specific fields,  
> which gets a little ugly.
> 
> The extra \_id field (no way to disable this and \_type, right?) adds a  
> little extra bloat to the index, but I'll take it to get the search  
> case-insensitive.
> 
> Maybe it makes sense to allow a filter to be applied to the internal  
> queryable fields?
> 
> Thanks,  
> Paul
> 
> On Sep 17, 11:35 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Why not lowercase before hand, so you won't store extra data in the  
> > index?
> > 
> > On Fri, Sep 17, 2010 at 7:33 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> > 
> > > Cool, thx.
> > 
> > > Will create my own versions.
> > 
> > > On Sep 17, 11:18 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > 
> > > > Hi, yea, those are not analyzed and you can't control it  
> > > > (intentionally,  
> > > > since analysis is can potentially break it up to more than a single  
> > > > term).
> > 
> > > > On Fri, Sep 17, 2010 at 7:11 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> > > > 
> > > > > I like that the internal \_index and \_id fields are available to  
> > > > > search  
> > > > > on. However, I am moving from a domain where we could do case  
> > > > > insensitive searches on these fields. In order to do this, I am  
> > > > > trying  
> > > > > to add a lowercase filter analyzer on these fields, but with no  
> > > > > luck.
> > 
> > > > > After creating the index, I have tried the following:
> > 
> > > > > curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping'-d'](http://localhost:9201/twitter/tweet/_mapping'-d')  
> > > > > {  
> > > > > "tweet" : {  
> > > > > "\_index" : { "enabled" : true, "analyzer" : "lowercase" }  
> > > > > }  
> > > > > }  
> > > > > '  
> > > > > curl -XPUT '[http://localhost:9201/twitter/tweet/\_mapping'-d'](http://localhost:9201/twitter/tweet/_mapping'-d')  
> > > > > {  
> > > > > "tweet" : {  
> > > > > "\_index" : { "enabled" : true },  
> > > > > "properties" : {  
> > > > > "\_index" : {"type" : "string", "analyzer" :  
> > > > > "sortable\_tokenizer" }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > '
> > 
> > > > > Neither seem to work.
> > 
> > > > > If analysis is not available on \_id/\_index fields, not the a big  
> > > > > deal,  
> > > > > I just need to disable the ES built in ones and add use my own.
> > 
> > > > > Thanks,  
> > > > > Paul

---

<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, 4:19am UTC](https://discuss.elastic.co/t/possible-to-lowercase-filter--index-and--id-fields/3345/7 "2017-07-06T04:19:13Z")

</div>


