# Update using "join" with other index

**URL:** <https://discuss.elastic.co/t/update-using-join-with-other-index/217010>\
**Category:** Elasticsearch\
**Created:** [January 29, 2020, 1:30pm UTC](https://discuss.elastic.co/t/update-using-join-with-other-index/217010 "2020-01-29T13:30:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MMH](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mmh/32/54449_2.png) [@MMH](https://discuss.elastic.co/u/MMH)\
**Post date:** [January 29, 2020, 1:30pm UTC](https://discuss.elastic.co/t/update-using-join-with-other-index/217010/1 "2020-01-29T13:30:17Z")

</div>

I am using Elasticsearch 6.5.  
Let's say that I have `index_trg`, that has fields: `id`, `value`, and some additional fields.  
I also have `index_src` with fields `id` and `new_value`, that is subset id `id`s from `index_trg`.  
What I want to do is: for every `id` from `index_src` update `index_trg`, so `index_trg.value` = `index_src.new_value`. In databases it would be equivalent of `UPADTE` using `JOIN`.  
Is such operation doable in the single Elasticsearch request?

---

<div class="post-metadata">

**Author:** ![inhinyera16](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inhinyera16/32/61625_2.png) [@inhinyera16](https://discuss.elastic.co/u/inhinyera16)\
**Post date:** [January 29, 2020, 2:09pm UTC](https://discuss.elastic.co/t/update-using-join-with-other-index/217010/2 "2020-01-29T14:09:09Z")

</div>

Unfortunately can't do joins in elasticsearch. You need to reindex the data with parent/child relationship. Or you can read this related topic.

> [@How to fetch data from multiple index using join like sql](https://discuss.elastic.co/t/how-to-fetch-data-from-multiple-index-using-join-like-sql/106131/5):
>
> Hi David, I prefer this example of normalization. PUT /my\_index/user/1 { "name": "John Smith", "email": "john@smith.com", "dob": "1970/10/24" } PUT /my\_index/blogpost/2 { "title": "Relationships", "body": "It's complicated...", "user": { "id": 1, "name": "John Smith" } } for fetching records used: GET /my\_index/blogpost/\_search { "query": { "bool": { "must": [ { "match": { "title": "relationships" }}, { "…

---

<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 26, 2020, 2:09pm UTC](https://discuss.elastic.co/t/update-using-join-with-other-index/217010/3 "2020-02-26T14:09:11Z")

</div>

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