# Lowercase id field

**URL:** https://discuss.elastic.co/t/lowercase-id-field/4266
**Category:** Elasticsearch
**Created:** [April 20, 2011, 2:07pm UTC](https://discuss.elastic.co/t/lowercase-id-field/4266 "2011-04-20T14:07:13Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Mustafa\_Sener](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@Mustafa\_Sener](https://discuss.elastic.co/u/Mustafa_Sener)
#### Post date: [April 20, 2011, 2:07pm UTC](https://discuss.elastic.co/t/lowercase-id-field/4266/1 "2011-04-20T14:07:13Z")

</div>

Hi,  
In order to get a document with a known id we have to be careful about case  
sensitivity. This is problematic in some situations. However, if we  
convert all id field to lowercase this problem will be solved. We modified  
following files and converted id to its lowercase version.  
SinglePingRequest.java  
DeleteRequest.java  
GetRequest.java  
IndexRequest.java  
SingleShardOperationRequest.java

Is it possible to make such a modification in ES master? Does it make sense?

## Thanks...

Mustafa Sener  
[www.ifountain.com](http://www.ifountain.com)  
WebRep  
Overall rating

---

<div class="post-metadata">

### Author: ![James\_Cook](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@James\_Cook](https://discuss.elastic.co/u/James_Cook)
#### Post date: [April 20, 2011, 3:20pm UTC](https://discuss.elastic.co/t/lowercase-id-field/4266/2 "2011-04-20T15:20:29Z")

</div>

You can specify a custom analyzer which will index the id as a lowercase  
value.

In our Elastic Search properties we specify:

index.analysis.analyzer.lowercase\_keyword.type=custom  
index.analysis.analyzer.lowercase\_keyword.tokenizer=keyword  
index.analysis.analyzer.lowercase\_keyword.filter.0=lowercase

Then in the mapping file, we specify the use of this analyzer:

"username":{"type": "string", "index": "analyzed",  
"analyzer":"lowercase\_keyword"},

_Jim Cook_  
_tracermedia interactive [http://www.tracermedia.com/](http://www.tracermedia.com/)_

On Wed, Apr 20, 2011 at 10:07 AM, Mustafa Sener [mustafa.sener@gmail.com](mailto:mustafa.sener@gmail.com)wrote:

> Hi,  
> In order to get a document with a known id we have to be careful about case  
> sensitivity. This is problematic in some situations. However, if we  
> convert all id field to lowercase this problem will be solved. We modified  
> following files and converted id to its lowercase version.  
> SinglePingRequest.java  
> DeleteRequest.java  
> GetRequest.java  
> IndexRequest.java  
> SingleShardOperationRequest.java
> 
> Is it possible to make such a modification in ES master? Does it make  
> sense?
> 
> ## Thanks...
> 
> Mustafa Sener  
> [www.ifountain.com](http://www.ifountain.com)  
> WebRep  
> Overall rating

---

<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: [April 20, 2011, 10:46pm UTC](https://discuss.elastic.co/t/lowercase-id-field/4266/3 "2011-04-20T22:46:51Z")

</div>

I don't think that it make sense to have case insensitive id. As one of many examples, some auto generates ids rely on being case sensitive. elasticsearch itself, by the way, base64 the auto generated UUID it does to make it smaller.  
On Wednesday, April 20, 2011 at 5:07 PM, Mustafa Sener wrote:

> Hi,  
> In order to get a document with a known id we have to be careful about case sensitivity. This is problematic in some situations. However, if we  
> convert all id field to lowercase this problem will be solved. We modified following files and converted id to its lowercase version.  
> SinglePingRequest.java  
> DeleteRequest.java  
> GetRequest.java  
> IndexRequest.java  
> SingleShardOperationRequest.java
> 
> Is it possible to make such a modification in ES master? Does it make sense?
> 
> ## Thanks...
> 
> Mustafa Sener  
> [www.ifountain.com](http://www.ifountain.com)  
> WebRep  
> Overall rating

---

<div class="post-metadata">

### Author: ![dbenson](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@dbenson](https://discuss.elastic.co/u/dbenson)
#### Post date: [April 20, 2011, 11:35pm UTC](https://discuss.elastic.co/t/lowercase-id-field/4266/4 "2011-04-20T23:35:21Z")

</div>

We ended up making our id field case insensitive, as we were getting  
duplicates. We had some data providers who weren't consistent in their  
case usage, so an updated document would appear as a duplicate.

We ended up solving this in our index submission app.

David

---

<div class="post-metadata">

### Author: ![Mustafa\_Sener](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@Mustafa\_Sener](https://discuss.elastic.co/u/Mustafa_Sener)
#### Post date: [April 21, 2011, 7:27am UTC](https://discuss.elastic.co/t/lowercase-id-field/4266/5 "2011-04-21T07:27:24Z")

</div>

I think we cannot specify analyzer for id fields right? I agree with David.  
We have same situation here. Some data provider cause duplicate records. I  
think at least there should be an option while defining mapping for id  
fields.

On Wed, Apr 20, 2011 at 6:20 PM, James Cook [jcook@tracermedia.com](mailto:jcook@tracermedia.com) wrote:

> You can specify a custom analyzer which will index the id as a lowercase  
> value.
> 
> In our Elastic Search properties we specify:
> 
> index.analysis.analyzer.lowercase\_keyword.type=custom  
> index.analysis.analyzer.lowercase\_keyword.tokenizer=keyword  
> index.analysis.analyzer.lowercase\_keyword.filter.0=lowercase
> 
> Then in the mapping file, we specify the use of this analyzer:
> 
> "username":{"type": "string", "index": "analyzed",  
> "analyzer":"lowercase\_keyword"},
> 
> _Jim Cook_  
> _tracermedia interactive [http://www.tracermedia.com/](http://www.tracermedia.com/)_
> 
> On Wed, Apr 20, 2011 at 10:07 AM, Mustafa Sener [mustafa.sener@gmail.com](mailto:mustafa.sener@gmail.com)wrote:
> 
> > Hi,  
> > In order to get a document with a known id we have to be careful about  
> > case sensitivity. This is problematic in some situations. However, if we  
> > convert all id field to lowercase this problem will be solved. We modified  
> > following files and converted id to its lowercase version.  
> > SinglePingRequest.java  
> > DeleteRequest.java  
> > GetRequest.java  
> > IndexRequest.java  
> > SingleShardOperationRequest.java
> > 
> > Is it possible to make such a modification in ES master? Does it make  
> > sense?
> > 
> > ## Thanks...
> > 
> > Mustafa Sener  
> > [www.ifountain.com](http://www.ifountain.com)  
> > WebRep  
> > Overall rating

--  
Mustafa Sener  
[www.ifountain.com](http://www.ifountain.com)

---

<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: [April 21, 2011, 10:17am UTC](https://discuss.elastic.co/t/lowercase-id-field/4266/6 "2011-04-21T10:17:15Z")

</div>

No, you can't specify it using an analyzer on the id field. The casing should be handled before it reaches a shard, since the hashing needs to make sure to take that into account. It can be added as a feature in the mapping definition.  
On Thursday, April 21, 2011 at 10:27 AM, Mustafa Sener wrote:

> I think we cannot specify analyzer for id fields right? I agree with David. We have same situation here. Some data provider cause duplicate records. I think at least there should be an option while defining mapping for id fields.
> 
> On Wed, Apr 20, 2011 at 6:20 PM, James Cook [jcook@tracermedia.com](mailto:jcook@tracermedia.com) wrote:
> 
> > You can specify a custom analyzer which will index the id as a lowercase value.
> > 
> > In our Elastic Search properties we specify:
> > 
> > > index.analysis.analyzer.lowercase\_keyword.type=custom
> > > 
> > > index.analysis.analyzer.lowercase\_keyword.tokenizer=keyword
> > > 
> > > index.analysis.analyzer.lowercase\_keyword.filter.0=lowercase
> > 
> > Then in the mapping file, we specify the use of this analyzer:
> > 
> > > "username":{"type": "string", "index": "analyzed", "analyzer":"lowercase\_keyword"},
> > 
> > Jim Cook  
> > tracermedia interactive
> > 
> > On Wed, Apr 20, 2011 at 10:07 AM, Mustafa Sener [mustafa.sener@gmail.com](mailto:mustafa.sener@gmail.com) wrote:
> > 
> > > Hi,  
> > > In order to get a document with a known id we have to be careful about case sensitivity. This is problematic in some situations. However, if we  
> > > convert all id field to lowercase this problem will be solved. We modified following files and converted id to its lowercase version.  
> > > SinglePingRequest.java  
> > > DeleteRequest.java  
> > > GetRequest.java  
> > > IndexRequest.java  
> > > SingleShardOperationRequest.java
> > > 
> > > Is it possible to make such a modification in ES master? Does it make sense?
> > > 
> > > ## Thanks...
> > > 
> > > Mustafa Sener  
> > > [www.ifountain.com](http://www.ifountain.com)  
> > > WebRep  
> > > Overall rating
> 
> --  
> Mustafa Sener  
> [www.ifountain.com](http://www.ifountain.com)

---

<div class="post-metadata">

### Author: ![James\_Cook](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@James\_Cook](https://discuss.elastic.co/u/James_Cook)
#### Post date: [April 21, 2011, 12:46pm UTC](https://discuss.elastic.co/t/lowercase-id-field/4266/7 "2011-04-21T12:46:12Z")

</div>

Yes, sorry for the misleading answer. I didn't realize that by "id", the OP  
meant the "\_id" field.

\*-- jim  
\*

On Thu, Apr 21, 2011 at 6:17 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> No, you can't specify it using an analyzer on the id field. The casing  
> should be handled before it reaches a shard, since the hashing needs to make  
> sure to take that into account. It can be added as a feature in the mapping  
> definition.
> 
> On Thursday, April 21, 2011 at 10:27 AM, Mustafa Sener wrote:
> 
> I think we cannot specify analyzer for id fields right? I agree with David.  
> We have same situation here. Some data provider cause duplicate records. I  
> think at least there should be an option while defining mapping for id  
> fields.
> 
> On Wed, Apr 20, 2011 at 6:20 PM, James Cook [jcook@tracermedia.com](mailto:jcook@tracermedia.com) wrote:
> 
> You can specify a custom analyzer which will index the id as a lowercase  
> value.
> 
> In our Elastic Search properties we specify:
> 
> index.analysis.analyzer.lowercase\_keyword.type=custom  
> index.analysis.analyzer.lowercase\_keyword.tokenizer=keyword  
> index.analysis.analyzer.lowercase\_keyword.filter.0=lowercase
> 
> Then in the mapping file, we specify the use of this analyzer:
> 
> "username":{"type": "string", "index": "analyzed",  
> "analyzer":"lowercase\_keyword"},
> 
> _Jim Cook_  
> _tracermedia interactive [http://www.tracermedia.com/](http://www.tracermedia.com/)_
> 
> On Wed, Apr 20, 2011 at 10:07 AM, Mustafa Sener [mustafa.sener@gmail.com](mailto:mustafa.sener@gmail.com)wrote:
> 
> Hi,  
> In order to get a document with a known id we have to be careful about case  
> sensitivity. This is problematic in some situations. However, if we  
> convert all id field to lowercase this problem will be solved. We modified  
> following files and converted id to its lowercase version.  
> SinglePingRequest.java  
> DeleteRequest.java  
> GetRequest.java  
> IndexRequest.java  
> SingleShardOperationRequest.java
> 
> Is it possible to make such a modification in ES master? Does it make  
> sense?
> 
> ## Thanks...
> 
> Mustafa Sener  
> [www.ifountain.com](http://www.ifountain.com)  
> WebRep  
> Overall rating
> 
> --  
> Mustafa Sener  
> [www.ifountain.com](http://www.ifountain.com)

---

<div class="post-metadata">

### Author: ![Mustafa\_Sener](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@Mustafa\_Sener](https://discuss.elastic.co/u/Mustafa_Sener)
#### Post date: [April 22, 2011, 5:47am UTC](https://discuss.elastic.co/t/lowercase-id-field/4266/8 "2011-04-22T05:47:59Z")

</div>

I created an issue for this feature

> <https://github.com/elastic/elasticsearch/issues/877>
>
> Add a setting to mapping definition to make \_id field case insensitive 
> 
> Discuss…ed in
> 
> http://elasticsearch-users.115913.n3.nabble.com/Lowercase-id-field-tp2843108p2843108.html

Thanks

On Thu, Apr 21, 2011 at 3:46 PM, James Cook [jcook@tracermedia.com](mailto:jcook@tracermedia.com) wrote:

> Yes, sorry for the misleading answer. I didn't realize that by "id", the OP  
> meant the "\_id" field.
> 
> \*-- jim  
> \*
> 
> On Thu, Apr 21, 2011 at 6:17 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> 
> > No, you can't specify it using an analyzer on the id field. The casing  
> > should be handled before it reaches a shard, since the hashing needs to make  
> > sure to take that into account. It can be added as a feature in the mapping  
> > definition.
> > 
> > On Thursday, April 21, 2011 at 10:27 AM, Mustafa Sener wrote:
> > 
> > I think we cannot specify analyzer for id fields right? I agree with  
> > David. We have same situation here. Some data provider cause duplicate  
> > records. I think at least there should be an option while defining mapping  
> > for id fields.
> > 
> > On Wed, Apr 20, 2011 at 6:20 PM, James Cook [jcook@tracermedia.com](mailto:jcook@tracermedia.com)wrote:
> > 
> > You can specify a custom analyzer which will index the id as a lowercase  
> > value.
> > 
> > In our Elastic Search properties we specify:
> > 
> > index.analysis.analyzer.lowercase\_keyword.type=custom  
> > index.analysis.analyzer.lowercase\_keyword.tokenizer=keyword  
> > index.analysis.analyzer.lowercase\_keyword.filter.0=lowercase
> > 
> > Then in the mapping file, we specify the use of this analyzer:
> > 
> > "username":{"type": "string", "index": "analyzed",  
> > "analyzer":"lowercase\_keyword"},
> > 
> > _Jim Cook_  
> > _tracermedia interactive [http://www.tracermedia.com/](http://www.tracermedia.com/)_
> > 
> > On Wed, Apr 20, 2011 at 10:07 AM, Mustafa Sener [mustafa.sener@gmail.com](mailto:mustafa.sener@gmail.com)wrote:
> > 
> > Hi,  
> > In order to get a document with a known id we have to be careful about  
> > case sensitivity. This is problematic in some situations. However, if we  
> > convert all id field to lowercase this problem will be solved. We modified  
> > following files and converted id to its lowercase version.  
> > SinglePingRequest.java  
> > DeleteRequest.java  
> > GetRequest.java  
> > IndexRequest.java  
> > SingleShardOperationRequest.java
> > 
> > Is it possible to make such a modification in ES master? Does it make  
> > sense?
> > 
> > ## Thanks...
> > 
> > Mustafa Sener  
> > [www.ifountain.com](http://www.ifountain.com)  
> > WebRep  
> > Overall rating
> > 
> > --  
> > Mustafa Sener  
> > [www.ifountain.com](http://www.ifountain.com)

--  
Mustafa Sener  
[www.ifountain.com](http://www.ifountain.com)

---

<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:07am UTC](https://discuss.elastic.co/t/lowercase-id-field/4266/9 "2017-07-06T04:07:53Z")

</div>


