# Access parent properties from nested query

**URL:** https://discuss.elastic.co/t/access-parent-properties-from-nested-query/5031
**Category:** Elasticsearch
**Created:** [August 2, 2011, 1:13pm UTC](https://discuss.elastic.co/t/access-parent-properties-from-nested-query/5031 "2011-08-02T13:13:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Felix\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felix_s/32/2933_2.png) [@Felix\_S](https://discuss.elastic.co/u/Felix_S)
#### Post date: [August 2, 2011, 1:13pm UTC](https://discuss.elastic.co/t/access-parent-properties-from-nested-query/5031/1 "2011-08-02T13:13:50Z")

</div>

Hi!

Is there any way to combine parent properties (e.g.  
"publication\_date") and nested-element properties (say,  
"comments.content") in a single nested query (with path "comments", in  
this case)? I know I could split the query in one nested part and  
another non-nested one, but in my case this is not feasible, since I'm  
working with rather complex, automatically generated queries. Is there  
a way to do this inside a single nested query?

Thanks!

Felix

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 2, 2011, 1:59pm UTC](https://discuss.elastic.co/t/access-parent-properties-from-nested-query/5031/2 "2011-08-02T13:59:55Z")

</div>

There isn't a way to do it, but, part of the work left for nested queries is  
to automatically detected fields that refer to nested objects, and convert  
them to nested queries, will that help in your case?

On Tue, Aug 2, 2011 at 4:13 PM, Felix Sappelt [f.sappelt@clueda.com](mailto:f.sappelt@clueda.com) wrote:

> Hi!
> 
> Is there any way to combine parent properties (e.g.  
> "publication\_date") and nested-element properties (say,  
> "comments.content") in a single nested query (with path "comments", in  
> this case)? I know I could split the query in one nested part and  
> another non-nested one, but in my case this is not feasible, since I'm  
> working with rather complex, automatically generated queries. Is there  
> a way to do this inside a single nested query?
> 
> Thanks!
> 
> Felix

---

<div class="post-metadata">

### Author: ![Felix\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felix_s/32/2933_2.png) [@Felix\_S](https://discuss.elastic.co/u/Felix_S)
#### Post date: [August 3, 2011, 12:05pm UTC](https://discuss.elastic.co/t/access-parent-properties-from-nested-query/5031/3 "2011-08-03T12:05:05Z")

</div>

I dont think it would, but that's a nice feature nonetheless. I think  
I'll just index all metadata with every nested object, that should  
work. Thanks!

On Aug 2, 3:59 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> There isn't a way to do it, but, part of the work left for nested queries is  
> to automatically detected fields that refer to nested objects, and convert  
> them to nested queries, will that help in your case?
> 
> On Tue, Aug 2, 2011 at 4:13 PM, Felix Sappelt [f.sapp...@clueda.com](mailto:f.sapp...@clueda.com) wrote:
> 
> > Hi!
> 
> > Is there any way to combine parent properties (e.g.  
> > "publication\_date") and nested-element properties (say,  
> > "comments.content") in a single nested query (with path "comments", in  
> > this case)? I know I could split the query in one nested part and  
> > another non-nested one, but in my case this is not feasible, since I'm  
> > working with rather complex, automatically generated queries. Is there  
> > a way to do this inside a single nested query?
> 
> > Thanks!
> 
> > Felix

---

<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, 3:58am UTC](https://discuss.elastic.co/t/access-parent-properties-from-nested-query/5031/4 "2017-07-06T03:58:22Z")

</div>


