Parent/Child Modeling Question


(Latchezar Kostov) #1

Hello all,

Per the Elastic 2.2 documentation, one of the restrictions of Parent/Child is that the Parent and Child types cannot be the same.

For that reason, I am trying to figure out what the best way would be to model some data as follows:

A parent device, such as a Router, may be of some type that includes an ID, and a Name. Now, a child of that server may be something like a Network Port, which itself would have an ID and a Name. This port may have many levels of sub-ports (logical ways of separating the network port), which would again have an ID and a Name. This is the way one of our Networking Monitoring Systems models it's devices, and I would like to save that relationship tree within Elastic.

An example of something I have seen is Router ---> Port ---> Sub-Port ---> Sub-Port ---> Sub-Port. I would want each one of these to be the same type, and to have a parent/child relationship so that I can ultimately walk up the tree and get to the top-most parent.

What is a good way of Modeling this if you cannot have the same type for a Parent and a Child, especially when you want to be able to always add a child to the last parent if it in fact has one?


(Mark Walkom) #2

You mean this - https://www.elastic.co/guide/en/elasticsearch/reference/2.0/breaking_20_parent_child_changes.html?

The mapping for the parent type can be added at the same time as the mapping for the child type, but cannot be added before the child type.


(system) #3