# Update the context of one document based on the context of other document (Please help)

**URL:** <https://discuss.elastic.co/t/update-the-context-of-one-document-based-on-the-context-of-other-document-please-help/316479>\
**Category:** Elasticsearch\
**Created:** [October 13, 2022, 3:07am UTC](https://discuss.elastic.co/t/update-the-context-of-one-document-based-on-the-context-of-other-document-please-help/316479 "2022-10-13T03:07:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Venkat\_Pavan1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/venkat_pavan1/32/100678_2.png) [@Venkat\_Pavan1](https://discuss.elastic.co/u/Venkat_Pavan1)\
**Post date:** [October 13, 2022, 3:07am UTC](https://discuss.elastic.co/t/update-the-context-of-one-document-based-on-the-context-of-other-document-please-help/316479/1 "2022-10-13T03:07:10Z")

</div>

Hey, We have two types of documents type A and type B both are connected through an Id field

Type A  
{  
"id": "abc",  
"name": "xyz",  
"class": "mno"  
}

Type B  
{  
"id": "abc",  
}  
I want to update all the Type B documents and I want them to have "name" field from the corresponding Type A document.  
So the final Type B document should look like  
Type B  
{  
"id": "abc",  
"name": "xyz"  
}  
Is it possible to do such updates through native elastic update queries?

---

<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:** [October 13, 2022, 10:55pm UTC](https://discuss.elastic.co/t/update-the-context-of-one-document-based-on-the-context-of-other-document-please-help/316479/2 "2022-10-13T22:55:38Z")

</div>

Welcome to our community! 😃

> [@Venkat\_Pavan1](#):
>
> Is it possible to do such updates through native elastic update queries?

No Elasticsearch cannot automatically do this for you. You can to do this in your own code during indexing, or you could use a reindex request to create new documents.

---

<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:** [November 10, 2022, 10:56pm UTC](https://discuss.elastic.co/t/update-the-context-of-one-document-based-on-the-context-of-other-document-please-help/316479/3 "2022-11-10T22:56:06Z")

</div>

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