ElasticSearch 6 recursive

Please give me a suggestion to how we can implement recursive functionality in Elastic search 6
i am new to elastic search
I am having a below calss
public class Employee
{
public int Emp_Id { get; set; }
public string Emp_Name { get; set; }
[Nested]
public Employee manager { get; set; }
}
data will be

Emp_Id Emp_Name Manager_id
1 a null
2 b 1
3 c 2
4 d 3

Here manager Id and employee id is are self join as parent child

My questions are below

  1. how can i create an index for above class and how can i insert data.
    2.after creating index, i need to search for employee and i should get the results like recursive
    as it is a self join
    i need result like below when we search for the employee id 4
    {
    "Emp_Id": 4,
    "Emp_Name": "d",
    "address": null,
    "manager": {
    "Emp_Id": 3,
    "Emp_Name": "c",
    "manager": {
    "Emp_Id": 2,
    "Emp_Name": "b",
    "manager": {
    "Emp_Id": 1,
    "Emp_Name": "a",
    "manager": null
    }
    }
    }
    }

Is it possible to get the result like this ?

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