# "Inherits" parents properties (hierarchy)

**URL:** <https://discuss.elastic.co/t/inherits-parents-properties-hierarchy/9289>\
**Category:** Elasticsearch\
**Created:** [October 9, 2012, 1:45pm UTC](https://discuss.elastic.co/t/inherits-parents-properties-hierarchy/9289 "2012-10-09T13:45:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manuel\_Vacelet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manuel_vacelet/32/2690_2.png) [@Manuel\_Vacelet](https://discuss.elastic.co/u/Manuel_Vacelet)\
**Post date:** [October 9, 2012, 1:45pm UTC](https://discuss.elastic.co/t/inherits-parents-properties-hierarchy/9289/1 "2012-10-09T13:45:41Z")

</div>

Hello,

I'm quite a newbie in ES world so please forgive me if I write something  
stupid.

I have data organized in a hierarchical way:  
.  
`-- [id=1 title="build a car" release="1.0"]`-- [id=2 title="find the wheels"]

When users look for "1.0" and "wheels" the should get document n°2  
I tried to use the "parent" relationship (when I create document n°2, I  
tell ES that document 1 is it's parent) but I get no results when I  
querying like  
{  
"query": {  
"bool": {  
"must": [  
{  
"term": {  
"release": "1.0"  
}  
},  
{  
"term": {  
"title": "wheels"  
}  
}  
]  
}  
}  
}

How can I solve my problem ?

Thanks,  
Manuel

--

---

<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 9, 2012, 1:55pm UTC](https://discuss.elastic.co/t/inherits-parents-properties-hierarchy/9289/2 "2012-10-09T13:55:28Z")

</div>

I think that nested docs fits better to your use case. See:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/nested-type.html)  
[http://www.elasticsearch.org/guide/reference/mapping/nested-type.html](http://www.elasticsearch.org/guide/reference/mapping/nested-type.html)

Have a look also at  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/has-child-query.html)  
[http://www.elasticsearch.org/guide/reference/query-dsl/has-child-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/has-child-query.html)  
and  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/has-parent-query.html)  
[http://www.elasticsearch.org/guide/reference/query-dsl/has-parent-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/has-parent-query.html)

I think (not sure) it can help here.

My 2 cents

David.

Le 9 octobre 2012 à 15:45, Manuel Vacelet [manuel.vacelet@gmail.com](mailto:manuel.vacelet@gmail.com) a écrit :

> Hello,
> 
> I'm quite a newbie in ES world so please forgive me if I write something  
> stupid.
> 
> I have data organized in a hierarchical way:  
> .  
> `-- [id=1 title="build a car" release="1.0"] `-- [id=2 title="find the wheels"]
> 
> When users look for "1.0" and "wheels" the should get document n°2  
> I tried to use the "parent" relationship (when I create document n°2, I tell  
> ES that document 1 is it's parent) but I get no results when I querying like  
> {  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "term": {  
> "release": "1.0"  
> }  
> },  
> {  
> "term": {  
> "title": " wheels"  
> }  
> }  
> ]  
> }  
> }  
> }
> 
> How can I solve my problem ?
> 
> Thanks,  
> Manuel
> 
> --

--  
David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<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:09am UTC](https://discuss.elastic.co/t/inherits-parents-properties-hierarchy/9289/3 "2017-07-06T03:09:35Z")

</div>


