# Join fields in script

**URL:** <https://discuss.elastic.co/t/join-fields-in-script/174271>\
**Category:** Elasticsearch\
**Created:** [March 28, 2019, 8:35am UTC](https://discuss.elastic.co/t/join-fields-in-script/174271 "2019-03-28T08:35:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aude\_Front](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aude_front/32/42958_2.png) [@Aude\_Front](https://discuss.elastic.co/u/Aude_Front)\
**Post date:** [March 28, 2019, 8:35am UTC](https://discuss.elastic.co/t/join-fields-in-script/174271/1 "2019-03-28T08:35:47Z")

</div>

Hi!  
Our index has a join field (parent documents with many child items). We would like to make a search on child items, with a filter that use some information from the parent document.  
Is it possible to access parent fields in the filter script? If so, how can we do it? Would it need a recent version of ES?  
Thanks!

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [March 29, 2019, 5:19pm UTC](https://discuss.elastic.co/t/join-fields-in-script/174271/2 "2019-03-29T17:19:48Z")

</div>

Parnt/child documents are not accessible to each other, as they are separate Lucene documents. Take a look at the [has parent query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-parent-query.html). From there you can filter which children match based on the respective parent.

---

<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:** [April 26, 2019, 5:19pm UTC](https://discuss.elastic.co/t/join-fields-in-script/174271/3 "2019-04-26T17:19:56Z")

</div>

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