# Query question on search dependent on results

**URL:** <https://discuss.elastic.co/t/query-question-on-search-dependent-on-results/205108>\
**Category:** Elasticsearch\
**Created:** [October 24, 2019, 3:11pm UTC](https://discuss.elastic.co/t/query-question-on-search-dependent-on-results/205108 "2019-10-24T15:11:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![berryma4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/berryma4/32/53667_2.png) [@berryma4](https://discuss.elastic.co/u/berryma4)\
**Post date:** [October 24, 2019, 3:11pm UTC](https://discuss.elastic.co/t/query-question-on-search-dependent-on-results/205108/1 "2019-10-24T15:11:21Z")

</div>

Is it possible to have a single query where the returned hits match the following:  
search a field "a", but also return records which have the same value for field "b" as the records returned by field "a".

---

<div class="post-metadata">

**Author:** ![berryma4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/berryma4/32/53667_2.png) [@berryma4](https://discuss.elastic.co/u/berryma4)\
**Post date:** [October 24, 2019, 3:22pm UTC](https://discuss.elastic.co/t/query-question-on-search-dependent-on-results/205108/2 "2019-10-24T15:22:54Z")

</div>

(basically, like an SQL subquery)

---

<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:** [October 24, 2019, 4:22pm UTC](https://discuss.elastic.co/t/query-question-on-search-dependent-on-results/205108/3 "2019-10-24T16:22:53Z")

</div>

That is a join, which is not supported by Elasticsearch.

---

<div class="post-metadata">

**Author:** ![berryma4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/berryma4/32/53667_2.png) [@berryma4](https://discuss.elastic.co/u/berryma4)\
**Post date:** [October 24, 2019, 5:57pm UTC](https://discuss.elastic.co/t/query-question-on-search-dependent-on-results/205108/4 "2019-10-24T17:57:54Z")

</div>

This article suggests a parent relationship:

> **[Parent and Child joins with ElasticSearch 7](https://medium.com/swlh/parent-and-child-joins-with-elasticsearch-7-381f6cca73fe)**
>
> The article walks through the Parent and Child relationships within Elastic Search.

---

<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 21, 2019, 5:58pm UTC](https://discuss.elastic.co/t/query-question-on-search-dependent-on-results/205108/5 "2019-11-21T17:58:02Z")

</div>

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