It is possible but needs some workarounds.
In general graph theory "parent" and "child" would be role metadata used to describe each of the nodes on an edge or in a directed graph the direction of the edge could imply the relationship (e.g. children always point to parents).
The thing to remember about the elasticsearch graph view of data is that the edges (we call them "connections") are aggregate edges - there could be ten thousand banking documents recording money transactions back and forth between A and B but we would summarise all these interactions in a single undirected connection between A and B. This is both a strength and a weakness.
If you want to capture the details of a parent/child relationship in a graph visualization you'd need to introduce the relationship as a special node/vertex term. Each node in the relationship would then need to define and edge-like document asserting that they are connected to this relationship-defining term. Here's how that would look for a grandparent -> parent ->child definition:
PUT relationships
{
"settings": {
"number_of_replicas": 0,
"number_of_shards": 1
},
"mappings": {
"relationship": {
"properties": {
"id": {
"type": "keyword"
},
"parent->child": {
"type": "keyword"
}
}
}
}
}
POST /relationships/relationship/_bulk
{ "index" : {} }
{"id": "A", "parent->child":"A is parent Of B"}
{ "index" : {} }
{"id": "B", "parent->child":"A is parent Of B"}
{ "index" : {} }
{"id": "B", "parent->child":"B is parent Of C"}
{ "index" : {} }
{"id": "C", "parent->child":"B is parent Of C"}
