# Characters to avoid in field names

**URL:** <https://discuss.elastic.co/t/characters-to-avoid-in-field-names/5783>\
**Category:** Elasticsearch\
**Created:** [November 6, 2011, 7:58pm UTC](https://discuss.elastic.co/t/characters-to-avoid-in-field-names/5783 "2011-11-06T19:58:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Hoffman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hoffman/32/1872_2.png) [@Nick\_Hoffman](https://discuss.elastic.co/u/Nick_Hoffman)\
**Post date:** [November 6, 2011, 7:58pm UTC](https://discuss.elastic.co/t/characters-to-avoid-in-field-names/5783/1 "2011-11-06T19:58:18Z")

</div>

Hey guys. After reading this thread[http://elasticsearch-users.115913.n3.nabble.com/Using-space-characters-in-a-field-s-name-td2760404.html](http://elasticsearch-users.115913.n3.nabble.com/Using-space-characters-in-a-field-s-name-td2760404.html)where kimchy said to avoid spaces in field names, I'm wondering what other  
characters should not be included in field names.

Thanks,  
Nick

---

<div class="post-metadata">

**Author:** ![Gabriel\_Farrell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_farrell/32/3337_2.png) [@Gabriel\_Farrell](https://discuss.elastic.co/u/Gabriel_Farrell)\
**Post date:** [November 7, 2011, 4:17am UTC](https://discuss.elastic.co/t/characters-to-avoid-in-field-names/5783/2 "2011-11-07T04:17:54Z")

</div>

On Sun, Nov 6, 2011 at 2:58 PM, Nick Hoffman [nick@deadorange.com](mailto:nick@deadorange.com) wrote:

> Hey guys. After reading this thread where kimchy said to avoid spaces in  
> field names, I'm wondering what other characters should not be included in  
> field names.

Also discussed in this thread:  
[https://groups.google.com/forum/#!topic/elasticsearch/-nR-O3RVjyM](https://groups.google.com/forum/#!topic/elasticsearch/-nR-O3RVjyM)

As mentioned there, Solr has dealt with this a bit:  
[https://issues.apache.org/jira/browse/SOLR-2606](https://issues.apache.org/jira/browse/SOLR-2606)

Since Lucene puts no restrictions on field name characters when you  
create the index, you'll only run into the problem when using certain  
features, such as the query parser. For starters, you'll probably want  
to avoid the special characters used in the query parser syntax  
([Apache Lucene - Query Parser Syntax](http://lucene.apache.org/java/3_4_0/queryparsersyntax.html)). There's  
a list at the end of that page, and note they can be escaped, but  
better not to need a bunch of backslashes, right?

Since Elasticsearch uses JSON for mapping and searching you won't run  
into some of the Solr issues, but since it uses dot notation for typed  
navigation and multi\_field access, you may want to avoid the dot as  
well.

In general, stick to alphanumeric and the underscore if possible.

---

<div class="post-metadata">

**Author:** ![Nick\_Hoffman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hoffman/32/1872_2.png) [@Nick\_Hoffman](https://discuss.elastic.co/u/Nick_Hoffman)\
**Post date:** [November 7, 2011, 5:19am UTC](https://discuss.elastic.co/t/characters-to-avoid-in-field-names/5783/3 "2011-11-07T05:19:03Z")

</div>

Thanks, Gabriel. That's really helpful, mate.

---

<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, 3:49am UTC](https://discuss.elastic.co/t/characters-to-avoid-in-field-names/5783/4 "2017-07-06T03:49:50Z")

</div>


