Parent/Child with one to many?


(James K) #1

Hello all, I'm trying to understand whether the parent child
functionality in elastic search will suit my needs or if I'm barking
up the wrong tree.

I have an index on forum posts with the body, user_id of the author.
I'd like to create an index on users (with age, gender etc) so that i
can search for posts containing a keyword that were created by a user
of a certain age.

At a high level, I'd like to do a search on posts with a has_child
query on a related user object. The problem here is that the user
would need many parents, do this doesn't seem to fit the model.

Anyone have any ideas on this?

thanks

-James


(Shay Banon) #2

Yea, it does not seem to fit the model. You should denoarmalize the posts and add the relevant user data to it.
On Thursday, April 28, 2011 at 10:53 PM, James K wrote:

Hello all, I'm trying to understand whether the parent child
functionality in elastic search will suit my needs or if I'm barking
up the wrong tree.

I have an index on forum posts with the body, user_id of the author.
I'd like to create an index on users (with age, gender etc) so that i
can search for posts containing a keyword that were created by a user
of a certain age.

At a high level, I'd like to do a search on posts with a has_child
query on a related user object. The problem here is that the user
would need many parents, do this doesn't seem to fit the model.

Anyone have any ideas on this?

thanks

-James


(system) #3