# Renaming nested fields

**URL:** https://discuss.elastic.co/t/renaming-nested-fields/134462
**Category:** Logstash
**Created:** [June 4, 2018, 4:51pm UTC](https://discuss.elastic.co/t/renaming-nested-fields/134462 "2018-06-04T16:51:06Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![Tiago\_Pinto](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiago_pinto/32/48669_2.png) [@Tiago\_Pinto](https://discuss.elastic.co/u/Tiago_Pinto)
#### Post date: [June 5, 2018, 5:37pm UTC](https://discuss.elastic.co/t/renaming-nested-fields/134462/10 "2018-06-05T17:37:45Z")

</div>

I feel I'm getting closer,

I've found on another post a way to do it but somehow it's not working for me.

I used the filter ruby plugin like this

```auto
filter {
	if([field1][nestedField]){
		ruby {
			code => "
				event.get('[field1][nestedField]').each { |k|
					k['camelCase1'] = k['lowercase1']
					k['camelCase2'] = k['lowercase2']
					k.delete('lowercase1')
					k.delete('lowercase2')
					logger.info('for each k', 'value' => k)
				}
				logger.info('full array' , 'value' => event.get('[field1][nestedField]'))
			"
		}
	}
}
```

The thing is when I print "k" in the logger it's exactly has I want it to be but when I print the whole array nothing has changed.

Am I missing some kind of set?

---

_[View the full topic](https://discuss.elastic.co/t/renaming-nested-fields/134462)._
