# \_id field limitations

**URL:** <https://discuss.elastic.co/t/id-field-limitations/109192>\
**Category:** Elasticsearch\
**Created:** [November 27, 2017, 9:31am UTC](https://discuss.elastic.co/t/id-field-limitations/109192 "2017-11-27T09:31:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seilat](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@seilat](https://discuss.elastic.co/u/seilat)\
**Post date:** [November 27, 2017, 9:31am UTC](https://discuss.elastic.co/t/id-field-limitations/109192/1 "2017-11-27T09:31:57Z")

</div>

Hi,

When using the \_bulk API its possible to index a document with \_id which contains malformed url characters such as '' and white spaces.

Later if one tries to use the GET API and reference the document \_id elastic returns

`GET testindex/testindex/sometext\\some text`  
`No handler found for uri [testindex/testindex/sometext\\some text] and method [GET]`

If one tries to PUT a document to and index with such a document \_id you get  
`PUT testindex/sometext\\some text`

```
{
  "error": "Content-Type header [text/plain] is not supported",
  "status": 406
}

```

if one tries to PUT a document with '' characters  
`PUT textindex10/sometext\\sometext`

`No handler found for uri [/testindex/sometext//sometext] and method [PUT]`

However using the _query ids API_, the document can be found using such an \_id.

I could not find any Elastic documentation on \_id field limitations...

---

<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:** [November 27, 2017, 9:49am UTC](https://discuss.elastic.co/t/id-field-limitations/109192/2 "2017-11-27T09:49:10Z")

</div>

The `PUT testindex/sometext\\some text` error message is unrelated.

It's just because you don't pass the Content-Type in your curl command IMO.

About the `_id` limitations, yes there are.  
I "think" that if you URLEncode the id, that should be ok. Unsure though.

FWIW, I believe you should open an issue so we try to reject properly that case if needed.

---

<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:** [December 25, 2017, 9:49am UTC](https://discuss.elastic.co/t/id-field-limitations/109192/3 "2017-12-25T09:49:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
