# Using a colon in a field name does not work?

**URL:** <https://discuss.elastic.co/t/using-a-colon-in-a-field-name-does-not-work/303143>\
**Category:** Elasticsearch\
**Created:** [April 25, 2022, 10:07am UTC](https://discuss.elastic.co/t/using-a-colon-in-a-field-name-does-not-work/303143 "2022-04-25T10:07:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johann-petrak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johann-petrak/32/70539_2.png) [@johann-petrak](https://discuss.elastic.co/u/johann-petrak)\
**Post date:** [April 25, 2022, 10:07am UTC](https://discuss.elastic.co/t/using-a-colon-in-a-field-name-does-not-work/303143/1 "2022-04-25T10:07:54Z")

</div>

I have the following as part of my mapping file:

```auto
"entities.name1:Name2": {
       "type": "nested"
      },

```

But the field does not actually end up nested in the index.

Is there a problem with the use of colons as part of a field name? Would I need to escape the colon in JSON string to make it work?

---

<div class="post-metadata">

**Author:** ![johann-petrak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johann-petrak/32/70539_2.png) [@johann-petrak](https://discuss.elastic.co/u/johann-petrak)\
**Post date:** [May 2, 2022, 8:29am UTC](https://discuss.elastic.co/t/using-a-colon-in-a-field-name-does-not-work/303143/3 "2022-05-02T08:29:38Z")

</div>

It turns out the reason must have been somewhere else, at some point it suddenly worked as expected. So the fact of the matter seems to be that the colon needs to get escaped in Kibana (which is annoying), but not in the mappings file or in the actual ES requests.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 3, 2022, 12:25am UTC](https://discuss.elastic.co/t/using-a-colon-in-a-field-name-does-not-work/303143/4 "2022-05-03T00:25:25Z")

</div>

Thanks for sharing that, and apologies for my post, it was for another topic!

---

<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 31, 2022, 12:26am UTC](https://discuss.elastic.co/t/using-a-colon-in-a-field-name-does-not-work/303143/5 "2022-05-31T00:26:18Z")

</div>

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