# Renaming fileds in nested json

**URL:** <https://discuss.elastic.co/t/renaming-fileds-in-nested-json/45189>\
**Category:** Logstash\
**Created:** [March 23, 2016, 8:08am UTC](https://discuss.elastic.co/t/renaming-fileds-in-nested-json/45189 "2016-03-23T08:08:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bongo\_zg](https://avatars.discourse-cdn.com/v4/letter/b/aca169/32.png) [@bongo\_zg](https://discuss.elastic.co/u/bongo_zg)\
**Post date:** [March 23, 2016, 8:08am UTC](https://discuss.elastic.co/t/renaming-fileds-in-nested-json/45189/1 "2016-03-23T08:08:17Z")

</div>

I have a json like:

> {"doc\_id": 1, "name": "John", "traveller": { "field\_1": "Johnny" }}

and would like to have it loaded like this:  
doc\_id =\> doc\_id  
name - ignored  
traveller.field\_1 =\> name\_1

I wrote a config file which obviously doesn't work:

> filter {  
> mutate {  
> remove\_field =\> ["name"]  
> replace =\> { "name" =\> "%{traveller.field\_1}" }}  
> }

but, the end result in ES is still:

> "\_source": {  
> "doc\_id": 1,  
> "traveller": {  
> "field\_1": "Johnny"  
> }

what have I missed?  
as Logstash cannot load nested JSON element into another type/entity, I would like to filter out outer elements, and load inner elements into a chosen entity.

tnx,

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 23, 2016, 10:09am UTC](https://discuss.elastic.co/t/renaming-fileds-in-nested-json/45189/2 "2016-03-23T10:09:02Z")

</div>

If you use the correct `[field][subfield]` syntax for nested fields I think it'll work.

[https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html)

---

<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, 5:05am UTC](https://discuss.elastic.co/t/renaming-fileds-in-nested-json/45189/3 "2017-07-06T05:05:44Z")

</div>


