# How to map such object fields

**URL:** <https://discuss.elastic.co/t/how-to-map-such-object-fields/125489>\
**Category:** Elasticsearch\
**Created:** [March 25, 2018, 2:17pm UTC](https://discuss.elastic.co/t/how-to-map-such-object-fields/125489 "2018-03-25T14:17:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssasporta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ssasporta/32/13695_2.png) [@ssasporta](https://discuss.elastic.co/u/ssasporta)\
**Post date:** [March 25, 2018, 2:17pm UTC](https://discuss.elastic.co/t/how-to-map-such-object-fields/125489/1 "2018-03-25T14:17:30Z")

</div>

How to map such fields?

**file.encoding = UTF-8**  
**file.encoding.pkg = [sun.io](http://sun.io)**  
**file.separator = /**

Thanks  
Sharon.

---

<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:** [March 25, 2018, 3:18pm UTC](https://discuss.elastic.co/t/how-to-map-such-object-fields/125489/2 "2018-03-25T15:18:24Z")

</div>

Depends on what you want to do but I'd probably use keyword data type

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 25, 2018, 3:30pm UTC](https://discuss.elastic.co/t/how-to-map-such-object-fields/125489/3 "2018-03-25T15:30:00Z")

</div>

In order to index those fields you will need to either rename or alter the structure. Dots in field names are special and will be expanded, which will cause a mapping conflict for `file.encoding` as this can not at the same time be a string and an object (as it has a sub-field named `pkg`).

---

<div class="post-metadata">

**Author:** ![ssasporta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ssasporta/32/13695_2.png) [@ssasporta](https://discuss.elastic.co/u/ssasporta)\
**Post date:** [March 25, 2018, 6:27pm UTC](https://discuss.elastic.co/t/how-to-map-such-object-fields/125489/4 "2018-03-25T18:27:22Z")

</div>

So, if the origin fields are:

**file.encoding = UTF-8**  
**file.encoding.pkg = [sun.io](http://sun.io)**

and I want to change it to:

**file.encoding.type = UTF-8**  
**file.encoding.pkg = [sun.io](http://sun.io)**

Which filters should I use?

I assume in this point, I will be able to create object mapping to file.encoding

Thanks  
Sharon.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 25, 2018, 6:56pm UTC](https://discuss.elastic.co/t/how-to-map-such-object-fields/125489/5 "2018-03-25T18:56:21Z")

</div>

I am not sure I understand your question. Could you please clarify with an example document?

---

<div class="post-metadata">

**Author:** ![ssasporta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ssasporta/32/13695_2.png) [@ssasporta](https://discuss.elastic.co/u/ssasporta)\
**Post date:** [March 25, 2018, 6:59pm UTC](https://discuss.elastic.co/t/how-to-map-such-object-fields/125489/6 "2018-03-25T18:59:55Z")

</div>

**Is this the syntax to rename it?**

```
mutate { rename => { "file.encoding" => "file.encoding.filetype" } }

```

Thanks  
Sharon

---

<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:** [April 22, 2018, 7:00pm UTC](https://discuss.elastic.co/t/how-to-map-such-object-fields/125489/7 "2018-04-22T19:00:17Z")

</div>

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