Parent/child relations in elasticsearch

hi,
i have some questions regarding parent/child relationships in ES.

  1. does 0.18.7 version support this feature? i mean both has_child,
    has_parent filter/queries. is top_children a workaround for this?

  2. it looks like the support is best for a simple parent/child relation but
    not a multi-generational case (
    http://elasticsearch-users.115913.n3.nabble.com/Querying-a-parent-type-that-is-also-a-child-type-for-another-type-td4023130.html).
    in my case, we have 4 levels of hierarchy and the bottommost type can have
    multiple parents. so if the parents of the child node exist in different
    shards, then isnt there a conflict?

  3. can the parent/child relation be established across indices?

thanks

--

Even in a simple parent/child relationship, if a child has many parents,
how does ES ensure that when a new parent is indexed, both the new parent
and existing child (and all its parents) get routed to the same shard?

thanks

On Tue, Nov 20, 2012 at 3:25 PM, T Vinod Gupta tvinod@readypulse.comwrote:

hi,
i have some questions regarding parent/child relationships in ES.

  1. does 0.18.7 version support this feature? i mean both has_child,
    has_parent filter/queries. is top_children a workaround for this?

  2. it looks like the support is best for a simple parent/child relation
    but not a multi-generational case (
    http://elasticsearch-users.115913.n3.nabble.com/Querying-a-parent-type-that-is-also-a-child-type-for-another-type-td4023130.html).
    in my case, we have 4 levels of hierarchy and the bottommost type can have
    multiple parents. so if the parents of the child node exist in different
    shards, then isnt there a conflict?

  3. can the parent/child relation be established across indices?

thanks

--

Hi,

multiple parents are not supported. Just single parent to many children.

Regards,
Lukas

On Wed, Nov 21, 2012 at 12:53 AM, T Vinod Gupta tvinod@readypulse.comwrote:

Even in a simple parent/child relationship, if a child has many parents,
how does ES ensure that when a new parent is indexed, both the new parent
and existing child (and all its parents) get routed to the same shard?

thanks

On Tue, Nov 20, 2012 at 3:25 PM, T Vinod Gupta tvinod@readypulse.comwrote:

hi,
i have some questions regarding parent/child relationships in ES.

  1. does 0.18.7 version support this feature? i mean both has_child,
    has_parent filter/queries. is top_children a workaround for this?

  2. it looks like the support is best for a simple parent/child relation
    but not a multi-generational case (
    http://elasticsearch-users.115913.n3.nabble.com/Querying-a-parent-type-that-is-also-a-child-type-for-another-type-td4023130.html).
    in my case, we have 4 levels of hierarchy and the bottommost type can have
    multiple parents. so if the parents of the child node exist in different
    shards, then isnt there a conflict?

  3. can the parent/child relation be established across indices?

thanks

--

--

Hi,

  1. Version 0.18.7 has parent child support, but this version doesn't
    support the has_parent filter/query all other child like
    filters/queries are supported. The latest 0.19 and 0.20 versions have
    a more efficient parent/child implementation.

  2. As is described in the referred email, you will need to use the top
    parent id as routing value for its sub parents and children documents
    during indexing. As Lukas wrote, a child document can only point to
    one parent document. That parent can point to a grand parent.

  3. Parent and child document relation can only be established in the
    same index. The relation is established between types in the same
    index. Each document type (parent, child) has its own mapping
    describing the relation with the _parent mapping.

Martijn

On 21 November 2012 07:56, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

multiple parents are not supported. Just single parent to many children.

Regards,
Lukas

On Wed, Nov 21, 2012 at 12:53 AM, T Vinod Gupta tvinod@readypulse.com
wrote:

Even in a simple parent/child relationship, if a child has many parents,
how does ES ensure that when a new parent is indexed, both the new parent
and existing child (and all its parents) get routed to the same shard?

thanks

On Tue, Nov 20, 2012 at 3:25 PM, T Vinod Gupta tvinod@readypulse.com
wrote:

hi,
i have some questions regarding parent/child relationships in ES.

  1. does 0.18.7 version support this feature? i mean both has_child,
    has_parent filter/queries. is top_children a workaround for this?

  2. it looks like the support is best for a simple parent/child relation
    but not a multi-generational case
    (http://elasticsearch-users.115913.n3.nabble.com/Querying-a-parent-type-that-is-also-a-child-type-for-another-type-td4023130.html).
    in my case, we have 4 levels of hierarchy and the bottommost type can have
    multiple parents. so if the parents of the child node exist in different
    shards, then isnt there a conflict?

  3. can the parent/child relation be established across indices?

thanks

--

--

--
Met vriendelijke groet,

Martijn van Groningen

--

thanks all for the replies, it really helps!

On Wed, Nov 21, 2012 at 12:45 AM, Martijn v Groningen <
martijn.v.groningen@gmail.com> wrote:

Hi,

  1. Version 0.18.7 has parent child support, but this version doesn't
    support the has_parent filter/query all other child like
    filters/queries are supported. The latest 0.19 and 0.20 versions have
    a more efficient parent/child implementation.

  2. As is described in the referred email, you will need to use the top
    parent id as routing value for its sub parents and children documents
    during indexing. As Lukas wrote, a child document can only point to
    one parent document. That parent can point to a grand parent.

  3. Parent and child document relation can only be established in the
    same index. The relation is established between types in the same
    index. Each document type (parent, child) has its own mapping
    describing the relation with the _parent mapping.

Martijn

On 21 November 2012 07:56, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

multiple parents are not supported. Just single parent to many children.

Regards,
Lukas

On Wed, Nov 21, 2012 at 12:53 AM, T Vinod Gupta tvinod@readypulse.com
wrote:

Even in a simple parent/child relationship, if a child has many parents,
how does ES ensure that when a new parent is indexed, both the new
parent
and existing child (and all its parents) get routed to the same shard?

thanks

On Tue, Nov 20, 2012 at 3:25 PM, T Vinod Gupta tvinod@readypulse.com
wrote:

hi,
i have some questions regarding parent/child relationships in ES.

  1. does 0.18.7 version support this feature? i mean both has_child,
    has_parent filter/queries. is top_children a workaround for this?

  2. it looks like the support is best for a simple parent/child relation
    but not a multi-generational case
    (
    http://elasticsearch-users.115913.n3.nabble.com/Querying-a-parent-type-that-is-also-a-child-type-for-another-type-td4023130.html
    ).
    in my case, we have 4 levels of hierarchy and the bottommost type can
    have
    multiple parents. so if the parents of the child node exist in
    different
    shards, then isnt there a conflict?

  3. can the parent/child relation be established across indices?

thanks

--

--

--
Met vriendelijke groet,

Martijn van Groningen

--

--