Employee Hierarchy Usecase

Whether Elastic Search supports to store the entire employee hierarchy. The lowest employee may have n number of supervisor. The manager of lowest employee may have n-1 number of supervisor.
Oracle support parent child recursive query to get all the supervisor in the hierarchy for of an employee.
How to arrange the data in Elastic Search? How to retrieve all the supervisors in the hierarchy for a given employee?
I see the parent and child relations were documented in ElasticSearch but the parent and child were of different type. In Employee Hierarchy the parent and child would be of same type.
Does Elastic Search supports this kind of usecase?

My first guess is to use a path tokenizer.

You have an example for another use case here: https://www.elastic.co/guide/en/elasticsearch/guide/current/denormalization-concurrency.html


But my requirement is to find all the managers in upper hierarchy for a given employee id.
The one you suggested gives me all the employees till the leaf node for a given manager.

Ok got your concept.

Hi dadoonet,

In that case i have to find upper hierarchy for every employee and store it in separate field and use that field as path tokenizer.
But finding upper hierarchy for every employee is very very costly operation.

Is there any way to run a recursion query option in Elastic Search to find the list manager in upper hierarchy?