Hi All,
I need help for getting all the leaf nodes details using elasticsearch query. If I have search for root node id and it contains childEntities then it should get all the child id and its name in result.
I have tried lot many things but it didn't work. So can someone help me on this. Please find three documents :
Doc 1 : {
"id": "2e12uu89dmn",
"name": "Test1",
"description": "Test1",
"parentEntities": ,
"childEntities": [
{
"children": [
{
"id": "wudq8u8028ddu",
"name": "Test2"
}]
}]
},
Doc 2 : {
"id": "wudq8u8028ddu",
"name": "Test2",
"description": "Test2",
"parentEntities": [
{
"id": "2e12uu89dmn",
"name": "Test1"
}
],
"childEntities": [
{
"children": [
{
"id": "euryeiuwiw",
"name": "Test3"
}]
}]
}
Doc 3 : {
"id": "euryeiuwiw",
"name": "Test3",
"description": "Test3",
"parentEntities": [
{
"id": "2e12uu89dmn",
"name": "Test1"
},
{
"id": "wudq8u8028ddu",
"name": "Test2"
}
],
"childEntities":
}
So let say if I search for parent "id": "2e12uu89dmn" in elasticsearch query then I should get all the leaf nodes(children).