# Is it possible to fire query in two indices and based on the result update third index?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-fire-query-in-two-indices-and-based-on-the-result-update-third-index/102854>\
**Category:** Elasticsearch\
**Created:** [October 5, 2017, 2:51pm UTC](https://discuss.elastic.co/t/is-it-possible-to-fire-query-in-two-indices-and-based-on-the-result-update-third-index/102854 "2017-10-05T14:51:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)\
**Post date:** [October 5, 2017, 2:51pm UTC](https://discuss.elastic.co/t/is-it-possible-to-fire-query-in-two-indices-and-based-on-the-result-update-third-index/102854/1 "2017-10-05T14:51:25Z")

</div>

Hi Exerts,

I have 3 indices

> ```
> student (name=vg, gopal etc)
> teacher (teachername=robert, bob etc)
> Class (classname=maths, english etc)
> 
> ```

What I want is to check student and teacher indices and based on a condition results I want to update school index  
something like if `name=vg , teachername= robert then class=maths` should be updater in Class index. This should be an automated process , so when data get into student , teacher index class modify accordingly ?

Regards  
VG

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 5, 2017, 3:05pm UTC](https://discuss.elastic.co/t/is-it-possible-to-fire-query-in-two-indices-and-based-on-the-result-update-third-index/102854/2 "2017-10-05T15:05:41Z")

</div>

No you can't do that.

What are you trying to do exactly? I mean: don't speak about the implementation but only the use case.

---

<div class="post-metadata">

**Author:** ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)\
**Post date:** [October 5, 2017, 3:39pm UTC](https://discuss.elastic.co/t/is-it-possible-to-fire-query-in-two-indices-and-based-on-the-result-update-third-index/102854/3 "2017-10-05T15:39:46Z")

</div>

Well , I have antivirus data , vulnerability data and Configuration data (cmdb) . Here requirement is if system affected with virus , also it is vulnerable then cmdb index should get update like it is critical system/machine .Second scenario would be if machines is affected but not vulnerable then it is low critical and so on..

---

<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 6, 2017, 1:29am UTC](https://discuss.elastic.co/t/is-it-possible-to-fire-query-in-two-indices-and-based-on-the-result-update-third-index/102854/4 "2017-10-06T01:29:43Z")

</div>

We recommend doing that at ingest time.

Take the event, look in the AV index, then the vulnerability index, then the CMDB index and add things to the original event accordingly.

---

<div class="post-metadata">

**Author:** ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)\
**Post date:** [October 6, 2017, 8:22am UTC](https://discuss.elastic.co/t/is-it-possible-to-fire-query-in-two-indices-and-based-on-the-result-update-third-index/102854/5 "2017-10-06T08:22:32Z")

</div>

This is what my plan is , thanks Mark

---

<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 3, 2017, 8:22am UTC](https://discuss.elastic.co/t/is-it-possible-to-fire-query-in-two-indices-and-based-on-the-result-update-third-index/102854/6 "2017-11-03T08:22:35Z")

</div>

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