Querying a nested graph data with deep hierarchies

I am new to graph databases in general, I played around with DGraph a bit and I am currently looking into ES X-Pack plugin which gives graph-like functionalities.

My requirement is something like this:

I have an account, a permission_set and bunch of roles. Each account is assigned a specific permission set and each permission set has got bunch of enabled roles.
A role could be an aggregate role, meaning, it could have bunch of roles under them.

Act001 --> PSet001
PSet001 --> List[R1, R2, R3*]
R3 --> List[R6*, R7]
R6 --> [R9, R22]

*aggregated role

When I query with account id - Act001 - I would need to pull all the roles per account(including the aggregated roles).
ie: List[R1, R2, R3, R6, R7, R9, R22]

I was able to achieve it with Dgraph and Dgraph way of storing data is different compared to ES.
Is this possible with elasticsearch graph API?

That's probably not the sweet spot for the elastic graph API because:

  1. Your data is likely to be comparatively small and searched very frequently (authorisation on every user request?). Under the covers the elastic graph API issues a separate search request for each "hop" which hits disk. These sorts of traversals on small, frequently-accessed datasets are probably better handled in RAM.
  2. Elastic graph API has no notion of direction. In your case the traversal from role to subroles is directional and we don't want to crawl from subrole back up to role. That sort of control over direction of travel is not in the simple API we provide so if you were to do this you might as well write code in your client app to loop around the expansions from a series of search requests.
2 Likes

I would say that your specific use case fits a proper graph database. At the best of my understanding, Elasticsearch offers only a graph view on top of a document set considering co-occurrency or terms or word.

would you use a fork to cut a steak?

1 Like

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