# Special characters in field names

**URL:** <https://discuss.elastic.co/t/special-characters-in-field-names/10658>\
**Category:** Elasticsearch\
**Created:** [February 7, 2013, 9:49pm UTC](https://discuss.elastic.co/t/special-characters-in-field-names/10658 "2013-02-07T21:49:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghoumard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghoumard/32/44886_2.png) [@ghoumard](https://discuss.elastic.co/u/ghoumard)\
**Post date:** [February 7, 2013, 9:49pm UTC](https://discuss.elastic.co/t/special-characters-in-field-names/10658/1 "2013-02-07T21:49:44Z")

</div>

Is there any restriction in using some characters in field names ?

Are these names valid ?

- "field.name"  
-"#fieldname"
- "@field.name"
- "-field.name"

Thanks !

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [February 8, 2013, 10:10am UTC](https://discuss.elastic.co/t/special-characters-in-field-names/10658/2 "2013-02-08T10:10:59Z")

</div>

On Thu, 2013-02-07 at 13:49 -0800, Gildas Houmard wrote:

> Is there any restriction in using some characters in field names ?
> 
> Are these names valid ?
> 
> - "field.name"  
> -"#fieldname"
> - "@field.name"
> - "-field.name"

I would avoid using embedded '.' as that is used to step into objects,  
eg { foo: { bar: 1}} could access bar using 'foo.bar'

Also, avoid starting a field name with \_

other than that, i think the other characters are legal

clint

> Thanks !
> 
> --  
> You received this message because you are subscribed to the Google  
> Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send  
> an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [February 8, 2013, 10:39am UTC](https://discuss.elastic.co/t/special-characters-in-field-names/10658/3 "2013-02-08T10:39:09Z")

</div>

I add that I would avoid + and - as you can use it in query string query as a must or must not clause.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 févr. 2013 à 11:10, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com) a écrit :

> On Thu, 2013-02-07 at 13:49 -0800, Gildas Houmard wrote:
> 
> > Is there any restriction in using some characters in field names ?
> > 
> > Are these names valid ?
> > 
> > - "field.name"  
> > -"#fieldname"
> > - "@field.name"
> > - "-field.name"
> 
> I would avoid using embedded '.' as that is used to step into objects,  
> eg { foo: { bar: 1}} could access bar using 'foo.bar'
> 
> Also, avoid starting a field name with \_
> 
> other than that, i think the other characters are legal
> 
> clint
> 
> > Thanks !
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![ghoumard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghoumard/32/44886_2.png) [@ghoumard](https://discuss.elastic.co/u/ghoumard)\
**Post date:** [February 8, 2013, 6:28pm UTC](https://discuss.elastic.co/t/special-characters-in-field-names/10658/4 "2013-02-08T18:28:30Z")

</div>

Make a lot of sense 😃  
Thanks Clint and David !

On Friday, February 8, 2013 5:39:09 AM UTC-5, David Pilato wrote:

> I add that I would avoid + and - as you can use it in query string query  
> as a must or must not clause.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 8 févr. 2013 à 11:10, Clinton Gormley \<[cl...@traveljury.com](mailto:cl...@traveljury.com)\<javascript:\>\>  
> a écrit :
> 
> > On Thu, 2013-02-07 at 13:49 -0800, Gildas Houmard wrote:
> > 
> > > Is there any restriction in using some characters in field names ?
> > > 
> > > Are these names valid ?
> > > 
> > > - "field.name"  
> > > -"#fieldname"
> > > - "@field.name"
> > > - "-field.name"
> > 
> > I would avoid using embedded '.' as that is used to step into objects,  
> > eg { foo: { bar: 1}} could access bar using 'foo.bar'
> > 
> > Also, avoid starting a field name with \_
> > 
> > other than that, i think the other characters are legal
> > 
> > clint
> > 
> > > Thanks !
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:52am UTC](https://discuss.elastic.co/t/special-characters-in-field-names/10658/5 "2017-07-06T02:52:20Z")

</div>


