# Problems with an Id with a number sign

**URL:** <https://discuss.elastic.co/t/problems-with-an-id-with-a-number-sign/127614>\
**Category:** Elasticsearch\
**Created:** [April 11, 2018, 10:53am UTC](https://discuss.elastic.co/t/problems-with-an-id-with-a-number-sign/127614 "2018-04-11T10:53:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![majid\_zarrin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/majid_zarrin/32/29103_2.png) [@majid\_zarrin](https://discuss.elastic.co/u/majid_zarrin)\
**Post date:** [April 11, 2018, 10:53am UTC](https://discuss.elastic.co/t/problems-with-an-id-with-a-number-sign/127614/1 "2018-04-11T10:53:55Z")

</div>

Hello,  
I have a document with a number sign (#) at the end of its Id.  
It makes some problems.  
I tried to delete it inside Kibana but no success.  
 ![43%20PM](https://us1.discourse-cdn.com/elastic/original/3X/1/b/1b852e4ee123c9e9bc43447413d15f3e7a5af1c0.png)

Also, I tried with Java High-Level REST Client but again no success. the client delete number sign from Id before sending the request.  
here is the DeleteResponse  
 ![56%20PM](https://us1.discourse-cdn.com/elastic/original/3X/d/c/dc4a1d82701401acb23fffec28b2514e3e457fb8.png)

ElasticSearch version = 6.2.3

Is it a bug?

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [April 11, 2018, 12:26pm UTC](https://discuss.elastic.co/t/problems-with-an-id-with-a-number-sign/127614/2 "2018-04-11T12:26:15Z")

</div>

The `#` sign is a reserved character in URLs, hence you need to URL-encode it (with `%23`) if you want to keep it at the end of your id.

```
# without URL-encoding
PUT channels/channel/vakilimotlagh#
{ "field1": 1 }

# with URL-encoding
PUT channels/channel/vakilimotlagh%23
{ "field2": 2 }

```

Then you'll see that the `#` is preserved in the latter document but not the former

`GET channels/_search`

Response:

```
  "hits": {
    "total": 2,
    "max_score": 1,
    "hits": [
      {
        "_index": "channels",
        "_type": "channel",
        "_id": "vakilimotlagh",
        "_score": 1,
        "_source": { "field1": 1 }
      },
      {
        "_index": "channels",
        "_type": "channel",
        "_id": "vakilimotlagh#",
        "_score": 1,
        "_source": { "field2": 2 }
      }
    ]
  }
}

```

Note, however, that the URL-encoding is only necessary if you want to use the `#` sign within an URL, if you were to create your document via the `_bulk` API, you wouldn't need to URL-encode it. THe following would work perfectly fine and preserve the `#` sign in the ID.

```
PUT channels/channel/_bulk
{"index": {"_id": "vakilimotlagh#" }}
{...}
```

---

<div class="post-metadata">

**Author:** ![majid\_zarrin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/majid_zarrin/32/29103_2.png) [@majid\_zarrin](https://discuss.elastic.co/u/majid_zarrin)\
**Post date:** [April 11, 2018, 1:59pm UTC](https://discuss.elastic.co/t/problems-with-an-id-with-a-number-sign/127614/3 "2018-04-11T13:59:47Z")

</div>

> [@val](#):
>
> %23

Thank you so much, It's works,

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [April 11, 2018, 2:01pm UTC](https://discuss.elastic.co/t/problems-with-an-id-with-a-number-sign/127614/4 "2018-04-11T14:01:11Z")

</div>

Perfect, I'm glad it works for you!

---

<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:** [May 9, 2018, 2:01pm UTC](https://discuss.elastic.co/t/problems-with-an-id-with-a-number-sign/127614/5 "2018-05-09T14:01:36Z")

</div>

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