# Assistance with parent/child relationships

**URL:** https://discuss.elastic.co/t/assistance-with-parent-child-relationships/7807
**Category:** Elasticsearch
**Created:** [May 22, 2012, 2:51pm UTC](https://discuss.elastic.co/t/assistance-with-parent-child-relationships/7807 "2012-05-22T14:51:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Jay\_Shirley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jay_shirley/32/2877_2.png) [@Jay\_Shirley](https://discuss.elastic.co/u/Jay_Shirley)
#### Post date: [May 22, 2012, 2:51pm UTC](https://discuss.elastic.co/t/assistance-with-parent-child-relationships/7807/1 "2012-05-22T14:51:57Z")

</div>

I'm struggling with this behavior and am uncertain of how to proceed  
with debugging. I've read through all the docs I can find, but still  
am not having any luck.

I am building a knowledge base search index, and a requirement is to  
be able to match posts with answers. This seems very obviously best  
suited as a parent/child relationship. A KB Post has many responses,  
which are the children. This is very similar to a blog and comment  
model. To be more similar to the documentation examples, I've just  
narrowed the example down to a post and tags (though my real world  
usage will be post -\> answers).

I've attempted to follow the documentation and have also setup the  
mappings. It seems they are correct in that the \_parent field is  
reporting correctly.

I've put everything in this gist that I think is needed to help me  
trouble-shoot: [https://gist.github.com/2758363](https://gist.github.com/2758363) but I may be missing  
something key.

The search is against only the single index (kb-post), the final file  
in the gist are the mappings in that index. It clearly says that kb-  
post-tag has a \_parent of kb-post, and the type kb-post has every  
property defined as I expect it.

Thanks for any help!

-Jay

---

<div class="post-metadata">

### Author: ![Jay\_Shirley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jay_shirley/32/2877_2.png) [@Jay\_Shirley](https://discuss.elastic.co/u/Jay_Shirley)
#### Post date: [May 23, 2012, 10:51pm UTC](https://discuss.elastic.co/t/assistance-with-parent-child-relationships/7807/2 "2012-05-23T22:51:50Z")

</div>

I thought that maybe the documents being inserted were after, or I was  
missing a re-index.

I've attempted this (reindexed with a confirmed correct mapping) but still  
having no luck on getting the parent/child relationship to work.

Does anybody have any debugging tips or any additional information I can  
look at?

Thanks,  
-Jay

On Tuesday, May 22, 2012 7:51:57 AM UTC-7, Jay Shirley wrote:

> I'm struggling with this behavior and am uncertain of how to proceed  
> with debugging. I've read through all the docs I can find, but still  
> am not having any luck.
> 
> I am building a knowledge base search index, and a requirement is to  
> be able to match posts with answers. This seems very obviously best  
> suited as a parent/child relationship. A KB Post has many responses,  
> which are the children. This is very similar to a blog and comment  
> model. To be more similar to the documentation examples, I've just  
> narrowed the example down to a post and tags (though my real world  
> usage will be post -\> answers).
> 
> I've attempted to follow the documentation and have also setup the  
> mappings. It seems they are correct in that the \_parent field is  
> reporting correctly.
> 
> I've put everything in this gist that I think is needed to help me  
> trouble-shoot: [Index Mapping · GitHub](https://gist.github.com/2758363) but I may be missing  
> something key.
> 
> The search is against only the single index (kb-post), the final file  
> in the gist are the mappings in that index. It clearly says that kb-  
> post-tag has a \_parent of kb-post, and the type kb-post has every  
> property defined as I expect it.
> 
> Thanks for any help!
> 
> -Jay

---

<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: [May 25, 2012, 8:44pm UTC](https://discuss.elastic.co/t/assistance-with-parent-child-relationships/7807/3 "2012-05-25T20:44:30Z")

</div>

Can you post a full curl recreation? A curl that creates the index with the  
relevant mappings, index some sample data, and then sends the failing  
search request.

On Thu, May 24, 2012 at 12:51 AM, Jay Shirley [jshirley@tdp.me](mailto:jshirley@tdp.me) wrote:

> I thought that maybe the documents being inserted were after, or I was  
> missing a re-index.
> 
> I've attempted this (reindexed with a confirmed correct mapping) but still  
> having no luck on getting the parent/child relationship to work.
> 
> Does anybody have any debugging tips or any additional information I can  
> look at?
> 
> Thanks,  
> -Jay
> 
> On Tuesday, May 22, 2012 7:51:57 AM UTC-7, Jay Shirley wrote:
> 
> > I'm struggling with this behavior and am uncertain of how to proceed  
> > with debugging. I've read through all the docs I can find, but still  
> > am not having any luck.
> > 
> > I am building a knowledge base search index, and a requirement is to  
> > be able to match posts with answers. This seems very obviously best  
> > suited as a parent/child relationship. A KB Post has many responses,  
> > which are the children. This is very similar to a blog and comment  
> > model. To be more similar to the documentation examples, I've just  
> > narrowed the example down to a post and tags (though my real world  
> > usage will be post -\> answers).
> > 
> > I've attempted to follow the documentation and have also setup the  
> > mappings. It seems they are correct in that the \_parent field is  
> > reporting correctly.
> > 
> > I've put everything in this gist that I think is needed to help me  
> > trouble-shoot: [https://gist.github.com/\*\*2758363](https://gist.github.com/**2758363)[https://gist.github.com/2758363](https://gist.github.com/2758363)but I may be missing  
> > something key.
> > 
> > The search is against only the single index (kb-post), the final file  
> > in the gist are the mappings in that index. It clearly says that kb-  
> > post-tag has a \_parent of kb-post, and the type kb-post has every  
> > property defined as I expect it.
> > 
> > Thanks for any help!
> > 
> > -Jay

---

<div class="post-metadata">

### Author: ![Jay\_Shirley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jay_shirley/32/2877_2.png) [@Jay\_Shirley](https://discuss.elastic.co/u/Jay_Shirley)
#### Post date: [May 25, 2012, 9:01pm UTC](https://discuss.elastic.co/t/assistance-with-parent-child-relationships/7807/4 "2012-05-25T21:01:31Z")

</div>

I would love to, however when I went back into es-head to start it's now  
working.

I think that perhaps my previous re-index I wasn't waiting long enough? I  
was reindexing and then immediately re-querying.

Perhaps it was something I was doing wrong.

What I was trying previously was to dynamically insert data and create the  
types, then I apply the mapping with the \_parent fields from what was  
inserted. I then would reindex.

I think now I have the index and mapping in there, so the new data seems to  
be available to query.

Is my understanding correct? I don't want to spend a lot more time  
researching it if that sounds plausible.

On Fri, May 25, 2012 at 1:44 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Can you post a full curl recreation? A curl that creates the index with  
> the relevant mappings, index some sample data, and then sends the failing  
> search request.
> 
> On Thu, May 24, 2012 at 12:51 AM, Jay Shirley [jshirley@tdp.me](mailto:jshirley@tdp.me) wrote:
> 
> > I thought that maybe the documents being inserted were after, or I was  
> > missing a re-index.
> > 
> > I've attempted this (reindexed with a confirmed correct mapping) but  
> > still having no luck on getting the parent/child relationship to work.
> > 
> > Does anybody have any debugging tips or any additional information I can  
> > look at?
> > 
> > Thanks,  
> > -Jay
> > 
> > On Tuesday, May 22, 2012 7:51:57 AM UTC-7, Jay Shirley wrote:
> > 
> > > I'm struggling with this behavior and am uncertain of how to proceed  
> > > with debugging. I've read through all the docs I can find, but still  
> > > am not having any luck.
> > > 
> > > I am building a knowledge base search index, and a requirement is to  
> > > be able to match posts with answers. This seems very obviously best  
> > > suited as a parent/child relationship. A KB Post has many responses,  
> > > which are the children. This is very similar to a blog and comment  
> > > model. To be more similar to the documentation examples, I've just  
> > > narrowed the example down to a post and tags (though my real world  
> > > usage will be post -\> answers).
> > > 
> > > I've attempted to follow the documentation and have also setup the  
> > > mappings. It seems they are correct in that the \_parent field is  
> > > reporting correctly.
> > > 
> > > I've put everything in this gist that I think is needed to help me  
> > > trouble-shoot: [https://gist.github.com/\*\*2758363](https://gist.github.com/**2758363)[https://gist.github.com/2758363](https://gist.github.com/2758363)but I may be missing  
> > > something key.
> > > 
> > > The search is against only the single index (kb-post), the final file  
> > > in the gist are the mappings in that index. It clearly says that kb-  
> > > post-tag has a \_parent of kb-post, and the type kb-post has every  
> > > property defined as I expect it.
> > > 
> > > Thanks for any help!
> > > 
> > > -Jay

---

<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:26am UTC](https://discuss.elastic.co/t/assistance-with-parent-child-relationships/7807/5 "2017-07-06T03:26:58Z")

</div>


