Are parents required with join fields?


(James Addison) #1

The docs at https://www.elastic.co/guide/en/elasticsearch/reference/master/parent-join.html don't make the following clear (or I couldn't see it):

Can I index a child document without referencing a parent? With the ES<6.0 type-based parent/child relationships, you could not index a child document without referencing a parent doc ID.

With ES>=6.0, it kind of looks like it's possible to do this now. As an example from my use case:

  • each Business would be indexed
  • each Business could own and run many Events (ie the parent->relationship)
  • however it is also possible for an Event to not have a Business association (ie blank, empty, null, whatever you want to call it - so it wouldn't have a parent)

In previous versions of ES, I had to create a separate doc type to hold the Events that had a parent (you were unable to index docs without a parent ID where the mapping had a parent defined).

So, long story short, can I simplify my indexes now and store parent and non-parent Events in the same typeless index using join fields? Thanks!

Edit: Looks like I've asked this sort of thing before join fields existed. (see Possible to have optional _parent field in future?)


Best practices for join field child doc without parent doc
(James Addison) #2

Any feedback here from experts? If I'm interpreting the docs correctly, I believe setting the join/relation property is not a requirement anymore. Just looking for confirmation.


(system) #3

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