I am trying to model cities and regions in elasticsearch, these would naturally be stored as a tree, whether they would be nested documents or parent child indexes would be dependent on how often we would have to update them.
I also would have another type of document stored, lets call this Restaurant, which would have a parentId that would reference a node in the tree.
I wanted to know if it is possible to make a single query, asking to bring back all restaurants that fall within A?
so if the trees look like this:
A\B\C
A\D\E
A\F\G\H
the restaurants being returned would be the ones that have parentIds of C,E,H.