# Multisearch in order to use the first query result as parameters to the second query

**URL:** <https://discuss.elastic.co/t/multisearch-in-order-to-use-the-first-query-result-as-parameters-to-the-second-query/246751>\
**Category:** Elasticsearch\
**Created:** [August 28, 2020, 11:27am UTC](https://discuss.elastic.co/t/multisearch-in-order-to-use-the-first-query-result-as-parameters-to-the-second-query/246751 "2020-08-28T11:27:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricardomaximino](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ricardomaximino/32/74690_2.png) [@ricardomaximino](https://discuss.elastic.co/u/ricardomaximino)\
**Post date:** [August 28, 2020, 11:27am UTC](https://discuss.elastic.co/t/multisearch-in-order-to-use-the-first-query-result-as-parameters-to-the-second-query/246751/1 "2020-08-28T11:27:40Z")

</div>

If I have an index PEOPLE with personid, name, birthday, relation where the relation is a list that contains the personid of the linked person.  
How can I use a \_msearch to search for a person and get only the documents of the linked person(s)

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 28, 2020, 11:38am UTC](https://discuss.elastic.co/t/multisearch-in-order-to-use-the-first-query-result-as-parameters-to-the-second-query/246751/2 "2020-08-28T11:38:35Z")

</div>

You can not. Queries submitted through an \_msearch request are processed in parallel without interaction or dependencies between them.

What you are looking for is a join which Elasticsearch does not support. You therefore need to use multiple sequential requests.

---

<div class="post-metadata">

**Author:** ![ricardomaximino](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ricardomaximino/32/74690_2.png) [@ricardomaximino](https://discuss.elastic.co/u/ricardomaximino)\
**Post date:** [August 28, 2020, 1:58pm UTC](https://discuss.elastic.co/t/multisearch-in-order-to-use-the-first-query-result-as-parameters-to-the-second-query/246751/3 "2020-08-28T13:58:37Z")

</div>

Thanks, you just save me a lot of time.

---

<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:** [September 25, 2020, 1:58pm UTC](https://discuss.elastic.co/t/multisearch-in-order-to-use-the-first-query-result-as-parameters-to-the-second-query/246751/4 "2020-09-25T13:58:37Z")

</div>

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