# Parent with a nested child advice

**URL:** <https://discuss.elastic.co/t/parent-with-a-nested-child-advice/68493>\
**Category:** Elasticsearch\
**Created:** [December 8, 2016, 11:12pm UTC](https://discuss.elastic.co/t/parent-with-a-nested-child-advice/68493 "2016-12-08T23:12:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiggyboo](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tiggyboo](https://discuss.elastic.co/u/tiggyboo)\
**Post date:** [December 8, 2016, 11:12pm UTC](https://discuss.elastic.co/t/parent-with-a-nested-child-advice/68493/1 "2016-12-08T23:12:23Z")

</div>

I'm looking to load denormalized table data in ES, but am finding myself somewhat overwhelmed with the alternatives. Here I am attempting to created a nested child of a parent - however, I get the

" **Can't specify parent if no parent field has been configured**"

error when I try to add the nested child. Here's what it looks like - I'm sure the rub is somewhere in how I'm indexing the nested piece. Any help appreciated!

> PUT my\_index  
> {  
> "mappings": {  
> "my\_parent": {},  
> "my\_child": {  
> "\_parent": {  
> "type": "my\_parent"  
> }  
> },  
> "my\_nested":{  
> "properties": {  
> "support": {  
> "type": "nested"  
> }  
> }  
> }  
> }  
> }

> PUT my\_index/my\_parent/1  
> {  
> "text": "This is a parent document"  
> }

> PUT my\_index/my\_child/2?parent=1  
> {  
> "text": "This is a child document"  
> }

> PUT my\_index/my\_nested/4?parent=1  
> {  
> "support" : [  
> {  
> "support.support\_ai":"333",  
> "support.support\_sort":"5",  
> "support.suppot\_desc":"Clinical Assistant",  
> "support.support\_note":"x",  
> "support.support\_phone":"(77)X-XXXX",  
> "support.support\_start\_date":"Nov 24",  
> "support.support\_end\_date":"Dec 31 2599 12:00:00:000AM"  
> },  
> {  
> "support.support\_ai":"394",  
> "support.support\_sort":"1",  
> "support.support\_desc":"Medical Secretary",  
> "support.support\_note":"y",  
> "support.support\_phone":"(77)Y-YYYY",  
> "support.support\_start\_date":"Jan 1 1900",  
> "support.support\_end\_date":"Dec 31 2599 12:00:00:000AM"  
> }  
> ]  
> }

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 12, 2016, 4:25am UTC](https://discuss.elastic.co/t/parent-with-a-nested-child-advice/68493/2 "2016-12-12T04:25:05Z")

</div>

You cannot mix parent/child and nested together like this.

---

<div class="post-metadata">

**Author:** ![tiggyboo](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tiggyboo](https://discuss.elastic.co/u/tiggyboo)\
**Post date:** [December 12, 2016, 3:54pm UTC](https://discuss.elastic.co/t/parent-with-a-nested-child-advice/68493/3 "2016-12-12T15:54:14Z")

</div>

I was afraid that might be the case. What would you recommend for mapping something like:

person ("parent")  
-\> work location (one or more)  
--\> phone (one or more)  
--\> administrative support phone (tied to work location - one or more)

My previous mapping that I had for Mongodb worked (conventional arrays,) but in Elasticsearch it wouldn't allow me to distinguish between children. Thanks in advance for any advice.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 12, 2016, 11:31pm UTC](https://discuss.elastic.co/t/parent-with-a-nested-child-advice/68493/4 "2016-12-12T23:31:34Z")

</div>

Just use multi-level children.

Parent is the person.  
Child is location and phone.  
Grand child is the last phone.

---

<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:** [January 9, 2017, 11:32pm UTC](https://discuss.elastic.co/t/parent-with-a-nested-child-advice/68493/5 "2017-01-09T23:32:09Z")

</div>

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