# Build relationship with other index using scripting

**URL:** <https://discuss.elastic.co/t/build-relationship-with-other-index-using-scripting/19935>\
**Category:** Elasticsearch\
**Created:** [September 24, 2014, 9:02am UTC](https://discuss.elastic.co/t/build-relationship-with-other-index-using-scripting/19935 "2014-09-24T09:02:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghav280392](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raghav280392/32/558_2.png) [@raghav280392](https://discuss.elastic.co/u/raghav280392)\
**Post date:** [September 24, 2014, 9:02am UTC](https://discuss.elastic.co/t/build-relationship-with-other-index-using-scripting/19935/1 "2014-09-24T09:02:35Z")

</div>

Hi  
I have two index say index1 and index2. When I insert a document into  
index1, I need to query index2 for additional information and append the  
result while inserting. I am trying to bring relationship within the  
document. Is this possible .

Insert to Index1  
|  
Doc1  
|  
Query Index2 and get Result  
|  
Doc1 + Result  
|  
Doc1+Result in Index1

Is is way of scripting possible?

Thank you

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3aad7c92-0c64-4a7b-8359-cae1fe5f9c8e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3aad7c92-0c64-4a7b-8359-cae1fe5f9c8e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:00am UTC](https://discuss.elastic.co/t/build-relationship-with-other-index-using-scripting/19935/2 "2017-07-06T01:00:17Z")

</div>

Closed on July 6, 2017, 1:00am UTC


