# Is it possible to disable URL decoding of the id?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-disable-url-decoding-of-the-id/10395>\
**Category:** Elasticsearch\
**Created:** [January 17, 2013, 5:04pm UTC](https://discuss.elastic.co/t/is-it-possible-to-disable-url-decoding-of-the-id/10395 "2013-01-17T17:04:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olav\_Gronas\_Gjerde](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@Olav\_Gronas\_Gjerde](https://discuss.elastic.co/u/Olav_Gronas_Gjerde)\
**Post date:** [January 17, 2013, 5:04pm UTC](https://discuss.elastic.co/t/is-it-possible-to-disable-url-decoding-of-the-id/10395/1 "2013-01-17T17:04:34Z")

</div>

When I try to create a new document like this:  
curl -XPUT "localhost:9200/testolav/rec/1+1%2F2" -d '{"field" : "one and a  
half"}'  
it returns a decoded id like this  
{"ok":true,"\_index":"testolav","\_type":"rec","\_id":"1 1/2","\_version":1}

I would like the id to still be url encoded, is this possible?

--

---

<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 17, 2013, 5:42pm UTC](https://discuss.elastic.co/t/is-it-possible-to-disable-url-decoding-of-the-id/10395/2 "2013-01-17T17:42:07Z")

</div>

Perhaps you can provide it inside the document itself as \_id field?  
I did not test it myself. Does it work?

On the other end, you can encode special characters like % to %25. Not sure it  
will work.

Le 17 janvier 2013 à 18:04, "Olav Grønås Gjerde" [olavgg@gmail.com](mailto:olavgg@gmail.com) a écrit :

> When I try to create a new document like this:  
> curl - XPUT "localhost:9200/testolav/rec/1+1%2F2" - d '{"field" : "one and a  
> half"}'  
> it returns a decoded id like this  
> { "ok" : true , "\_index" : "testolav" , "\_type" : "rec" , "\_id" : "1 1/2" ,  
> "\_version" : 1 }
> 
> I would like the id to still be url encoded, is this possible?
> 
> --

--  
David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 17, 2013, 6:07pm UTC](https://discuss.elastic.co/t/is-it-possible-to-disable-url-decoding-of-the-id/10395/3 "2013-01-17T18:07:11Z")

</div>

On Thu, 2013-01-17 at 09:04 -0800, Olav Grønås Gjerde wrote:

> When I try to create a new document like this:  
> curl -XPUT "localhost:9200/testolav/rec/1+1%2F2" -d '{"field" : "one  
> and a half"}'
> 
> it returns a decoded id like this  
> {"ok":true,"\_index":"testolav","\_type":"rec","\_id":"1  
> 1/2","\_version":1}
> 
> I would like the id to still be url encoded, is this possible?

Double encode it when you index (or whenever you pass it in the URL)

clint

--

---

<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, 2:55am UTC](https://discuss.elastic.co/t/is-it-possible-to-disable-url-decoding-of-the-id/10395/4 "2017-07-06T02:55:53Z")

</div>


