# Update document, by moving a node within the document

**URL:** <https://discuss.elastic.co/t/update-document-by-moving-a-node-within-the-document/223721>\
**Category:** Elasticsearch\
**Created:** [March 16, 2020, 9:36am UTC](https://discuss.elastic.co/t/update-document-by-moving-a-node-within-the-document/223721 "2020-03-16T09:36:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaim\_turkel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chaim_turkel/32/64495_2.png) [@chaim\_turkel](https://discuss.elastic.co/u/chaim_turkel)\
**Post date:** [March 16, 2020, 9:36am UTC](https://discuss.elastic.co/t/update-document-by-moving-a-node-within-the-document/223721/1 "2020-03-16T09:36:53Z")

</div>

I have a multiple document, that have nested objects. I need to move the location of the nested objects within the document.

How can i do this, say move users out of groups in the following example:

{  
"resourceGroup": "",  
"abc": "Ok",  
"firstSeen": "2020-03-16T08:45:02.444Z",  
"entityId": "29e7d555-1959-4b9b-b663-ce0d04f3e5a7",  
"type": "GroupEntity",  
"group": {  
"onPremisesProvisioningErrors": ,  
"mailNickname": "74b06328-1",  
"users": [  
{  
"mail": "[abc@aaa.com](mailto:abc@aaa.com)",  
"mailNickname": "sdf"  
},  
{  
"displayName": "test user",  
"mailNickname": "testuser1"  
}  
],}  
}

---

<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 16, 2020, 2:04pm UTC](https://discuss.elastic.co/t/update-document-by-moving-a-node-within-the-document/223721/2 "2020-03-16T14:04:02Z")

</div>

An update of a document is always a full reindex operation. This means you either store the full document again with the correct JSON or you use the [Update API](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/docs-update.html) - however that one requires you to use scripting in this specific case.

Hope that helps!

---

<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 13, 2020, 2:04pm UTC](https://discuss.elastic.co/t/update-document-by-moving-a-node-within-the-document/223721/3 "2020-04-13T14:04:26Z")

</div>

Closed on April 13, 2020, 2:04pm UTC

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