# Can a special character be used in an object \_type?

**URL:** <https://discuss.elastic.co/t/can-a-special-character-be-used-in-an-object--type/95933>\
**Category:** Elasticsearch\
**Created:** [August 4, 2017, 5:08pm UTC](https://discuss.elastic.co/t/can-a-special-character-be-used-in-an-object--type/95933 "2017-08-04T17:08:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![YeeP](https://avatars.discourse-cdn.com/v4/letter/y/41988e/32.png) [@YeeP](https://discuss.elastic.co/u/YeeP)\
**Post date:** [August 4, 2017, 5:08pm UTC](https://discuss.elastic.co/t/can-a-special-character-be-used-in-an-object--type/95933/1 "2017-08-04T17:08:20Z")

</div>

I am just getting ready to start a new application. One of the objects is going to be based on a distribution list name that will come from the front end . Could I use this distribution list name as a \_type without removing the "#" from the start of it?

Example  
"theUser"{  
"\_type":"#distribution\_1"  
{  
"stuff":"String"  
}  
"\_type":"#distribution\_2"  
{  
"stuff":"String"  
}  
}

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [August 4, 2017, 10:56pm UTC](https://discuss.elastic.co/t/can-a-special-character-be-used-in-an-object--type/95933/2 "2017-08-04T22:56:49Z")

</div>

No, elasticsearch will reject type names with certain special characters (and # is one of those). Also note that types are going away: [https://github.com/elastic/elasticsearch/issues/15613](https://github.com/elastic/elasticsearch/issues/15613)

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [August 4, 2017, 10:57pm UTC](https://discuss.elastic.co/t/can-a-special-character-be-used-in-an-object--type/95933/3 "2017-08-04T22:57:46Z")

</div>

But you can put the value into your own field which you can use as a filter. That is actually what the recommended replacement for types if you really need them.

---

<div class="post-metadata">

**Author:** ![YeeP](https://avatars.discourse-cdn.com/v4/letter/y/41988e/32.png) [@YeeP](https://discuss.elastic.co/u/YeeP)\
**Post date:** [August 7, 2017, 3:18pm UTC](https://discuss.elastic.co/t/can-a-special-character-be-used-in-an-object--type/95933/4 "2017-08-07T15:18:36Z")

</div>

rjernst - is there any performance value in beginning to just create new indices where I would typically make a new \_type? I was considering what you brought up, and was going to just change "\_type" to and new field called "type". Just want to make sure this is modeled correctly for upcoming releases.

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [August 9, 2017, 3:44am UTC](https://discuss.elastic.co/t/can-a-special-character-be-used-in-an-object--type/95933/5 "2017-08-09T03:44:58Z")

</div>

Changing your application to use it's own `type` will work better with upcoming releases. However, as I mentioned, think about whether you really need multiple types within the same index, or could use separate indexes.

---

<div class="post-metadata">

**Author:** ![YeeP](https://avatars.discourse-cdn.com/v4/letter/y/41988e/32.png) [@YeeP](https://discuss.elastic.co/u/YeeP)\
**Post date:** [August 9, 2017, 5:36pm UTC](https://discuss.elastic.co/t/can-a-special-character-be-used-in-an-object--type/95933/6 "2017-08-09T17:36:31Z")

</div>

Yes, thank you rjernst. I have already reworked the data structure for this application to only have 1 type per index. I just want to make sure that it will be "sitting pretty" for the forseable future of updates, It seems strange to me to have some many indicies, versus sorting data "relationships" by \_type. No big deal really though, thanks for mentioning it to me.

---

<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:** [September 6, 2017, 5:36pm UTC](https://discuss.elastic.co/t/can-a-special-character-be-used-in-an-object--type/95933/7 "2017-09-06T17:36:44Z")

</div>

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