# Reindexing to duplicate a field into new raw field

**URL:** <https://discuss.elastic.co/t/reindexing-to-duplicate-a-field-into-new-raw-field/80629>\
**Category:** Elasticsearch\
**Created:** [March 30, 2017, 8:34am UTC](https://discuss.elastic.co/t/reindexing-to-duplicate-a-field-into-new-raw-field/80629 "2017-03-30T08:34:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brscvs](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@brscvs](https://discuss.elastic.co/u/brscvs)\
**Post date:** [March 30, 2017, 8:34am UTC](https://discuss.elastic.co/t/reindexing-to-duplicate-a-field-into-new-raw-field/80629/1 "2017-03-30T08:34:29Z")

</div>

Hi,  
I have an index with analyzed parameter, what I want to do is duplicate this parameter into new not analyzed raw field of this param.  
I have created the new mappings with the new raw field of that parameter.  
When I reindex with  
"script": "ctx.volname.raw.value = ctx.\_source.volname"

I get "Cannot get property 'raw' on null object"

What is the correct way to do this and where can I learn more about how to use fields and debug scripting. Language is groovy and elastic version is 2.4.

Thanks

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 31, 2017, 7:10am UTC](https://discuss.elastic.co/t/reindexing-to-duplicate-a-field-into-new-raw-field/80629/2 "2017-03-31T07:10:05Z")

</div>

Hey,

you need to use multi fields in the mapping and add the new field in there, and then you can trigger a regular reindex operation, without any scripting.

--Alex

---

<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 28, 2017, 7:10am UTC](https://discuss.elastic.co/t/reindexing-to-duplicate-a-field-into-new-raw-field/80629/3 "2017-04-28T07:10:07Z")

</div>

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