# How to retrieve and/or store former data that has been overwritten

**URL:** <https://discuss.elastic.co/t/how-to-retrieve-and-or-store-former-data-that-has-been-overwritten/72544>\
**Category:** Elasticsearch\
**Created:** [January 23, 2017, 9:56pm UTC](https://discuss.elastic.co/t/how-to-retrieve-and-or-store-former-data-that-has-been-overwritten/72544 "2017-01-23T21:56:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdicken73](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@tdicken73](https://discuss.elastic.co/u/tdicken73)\
**Post date:** [January 23, 2017, 9:56pm UTC](https://discuss.elastic.co/t/how-to-retrieve-and-or-store-former-data-that-has-been-overwritten/72544/1 "2017-01-23T21:56:46Z")

</div>

I need to be able to copy specific columns of data to an archival column within the same record when the record is updated. For instance, if a record had phoneNumber stored as 123-4567 and was updated to 321-8765, I would want to store the initial phone number in a second column called oldPhoneNumber which would hold onto the initial data. The only way I know to do this is to use the copy\_to functionality when mapping the index, but to my knowledge that would overwrite both the original and former data column. Is there any other way of doing this in elasticsearch?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 24, 2017, 8:03am UTC](https://discuss.elastic.co/t/how-to-retrieve-and-or-store-former-data-that-has-been-overwritten/72544/2 "2017-01-24T08:03:37Z")

</div>

There is nothing native to ES that does this, you'd have to handle it yourself.

---

<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:** [January 24, 2017, 8:06am UTC](https://discuss.elastic.co/t/how-to-retrieve-and-or-store-former-data-that-has-been-overwritten/72544/3 "2017-01-24T08:06:31Z")

</div>

You may be able to achieve this by using [scripted updates](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/docs-update.html#_scripted_updates).

---

<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:** [February 21, 2017, 8:06am UTC](https://discuss.elastic.co/t/how-to-retrieve-and-or-store-former-data-that-has-been-overwritten/72544/4 "2017-02-21T08:06:36Z")

</div>

Closed on February 21, 2017, 8:06am UTC

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