# Cannot GET \_source if \_id has spaces in it

**URL:** <https://discuss.elastic.co/t/cannot-get-source-if-id-has-spaces-in-it/201045>\
**Category:** Elasticsearch\
**Created:** [September 25, 2019, 1:33pm UTC](https://discuss.elastic.co/t/cannot-get-source-if-id-has-spaces-in-it/201045 "2019-09-25T13:33:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [September 25, 2019, 1:33pm UTC](https://discuss.elastic.co/t/cannot-get-source-if-id-has-spaces-in-it/201045/1 "2019-09-25T13:33:59Z")

</div>

We have a document indexed with the \_id field set to "STT -30247-010" (note the space).

We are unable to retrieve this document via the API (documents without spaces in the \_id) work fine.

With a \_search (`q=_id="STT -30247-010"`) we can retrieve it.

Is there any way to retreive the document directly via the ID (not search)?

```
GET /myindex/_source/STT%20-30247-010 => 404
GET /myindex/_source/STT+-30247-010 => 404
GET /myindex/_source/STT -30247-010 => 404
```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [September 25, 2019, 2:31pm UTC](https://discuss.elastic.co/t/cannot-get-source-if-id-has-spaces-in-it/201045/2 "2019-09-25T14:31:47Z")

</div>

Hey,

I just tried this locally and it worked:

```auto
PUT foo/_doc/STT+-30247-010
{
  "key" : "value"
}

GET foo/_doc/STT+-30247-010

GET foo/_source/STT+-30247-010

GET foo/_search

```

what elasticsearch version are you testing against?

--Alex

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [September 26, 2019, 8:48am UTC](https://discuss.elastic.co/t/cannot-get-source-if-id-has-spaces-in-it/201045/3 "2019-09-26T08:48:40Z")

</div>

7.3 and now it's suddenly working today. Confused.

---

<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:** [October 24, 2019, 8:53am UTC](https://discuss.elastic.co/t/cannot-get-source-if-id-has-spaces-in-it/201045/5 "2019-10-24T08:53:06Z")

</div>

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