# Efficient copying of document to new instance and changing a couple fields

**URL:** <https://discuss.elastic.co/t/efficient-copying-of-document-to-new-instance-and-changing-a-couple-fields/39092>\
**Category:** Elasticsearch\
**Created:** [January 13, 2016, 11:37am UTC](https://discuss.elastic.co/t/efficient-copying-of-document-to-new-instance-and-changing-a-couple-fields/39092 "2016-01-13T11:37:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryan\_rasmussen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryan_rasmussen/32/874_2.png) [@bryan\_rasmussen](https://discuss.elastic.co/u/bryan_rasmussen)\
**Post date:** [January 13, 2016, 11:37am UTC](https://discuss.elastic.co/t/efficient-copying-of-document-to-new-instance-and-changing-a-couple-fields/39092/1 "2016-01-13T11:37:33Z")

</div>

I have a document in an index I need to make another document in the index that has almost all the same fields but with of course a new \_id, and a couple fields different.

Obviously I can get the document, change the fields, and then insert the new document but I was hoping there was some efficient way of handling this use case - I am using node.js elasticsearch client currently.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [January 13, 2016, 2:50pm UTC](https://discuss.elastic.co/t/efficient-copying-of-document-to-new-instance-and-changing-a-couple-fields/39092/2 "2016-01-13T14:50:08Z")

</div>

I'm working on a simpler way to do this over [here](https://github.com/elastic/elasticsearch/pull/15125). Under the covers it fetches the document and modifies it and reindexes it just like you want to do. So if I were you that is what I'd do. For the most part it is the only way to do it.

---

<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 5, 2017, 11:24pm UTC](https://discuss.elastic.co/t/efficient-copying-of-document-to-new-instance-and-changing-a-couple-fields/39092/3 "2017-07-05T23:24:52Z")

</div>


