# How to copy (or rename) a complex field into another field?

**URL:** <https://discuss.elastic.co/t/how-to-copy-or-rename-a-complex-field-into-another-field/61015>\
**Category:** Logstash\
**Created:** [September 20, 2016, 12:55pm UTC](https://discuss.elastic.co/t/how-to-copy-or-rename-a-complex-field-into-another-field/61015 "2016-09-20T12:55:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vandamo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vandamo/32/8203_2.png) [@vandamo](https://discuss.elastic.co/u/vandamo)\
**Post date:** [September 20, 2016, 12:55pm UTC](https://discuss.elastic.co/t/how-to-copy-or-rename-a-complex-field-into-another-field/61015/1 "2016-09-20T12:55:45Z")

</div>

Hi,  
I'd like to keep all the information from rabbitmq\_properties that are stored in [@metadata][rabbitmq\_properties].

To achieve that, I wanted to copy the complex element into another field (not under @metadata), but haven't succeeded yet.

I tried to use  
`mutate { add_field => { "headers" => "%{[@metadata][rabbitmq_headers]}" }}`  
And also  
`mutate { rename=> { [@metadata][rabbitmq_headers] => headers }}`

Neither seems to work.  
From the format of add\_field, and general information gathered, it seems the expectation is that the resulting added\_field would be of type string, so apparently not a valid option for my use case

The rename approach also fails, although I currently haven't found a justification as to why it wouldn't be a valid config.

---

<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:** [September 25, 2016, 7:18pm UTC](https://discuss.elastic.co/t/how-to-copy-or-rename-a-complex-field-into-another-field/61015/2 "2016-09-25T19:18:26Z")

</div>

Yeah, I don't think this is very well supported. You probably need to use a ruby filter.

---

<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, 4:37am UTC](https://discuss.elastic.co/t/how-to-copy-or-rename-a-complex-field-into-another-field/61015/3 "2017-07-06T04:37:04Z")

</div>


