Possible to query for hierarchical data across documents?

Currently N1QL doesn’t support CONNECT BY

Based on your out put it is not possible. Check this post if u can build something similar