I want to fetch hierarchical data using elastic search
I have tried 'has_parent' ,'has_child' and 'term- aggregation' but it is returning hierarchy only up to 1 level. But I want to get complete hierarchy for specific offer.
I have an index of type ‘offers’.
Let’s say it contains below documents as described below:
Each offer is being referred by another offer and that offer is again being referred by an another offer. So on.
Ex: Offer_A is being referred by offer_B , Offer_B is being referred by Offer_C and Offer_D this may go to any level
{
“id”: “offer_A”,
“dependsOnOffer” :[
“offer_X”
]
}
{
“id”: “offer_B”,
“dependsOnOffer” :[
“offer_A”
]
}
{
“id”: “offer _C”,
“dependsOnOffer” :[
“offer_B”
]
}
{
“id”: “offer_D”,
“dependsOnOffer” :[
“offer_B”
]
}
Desired Output :
When I am looking for offer_A and want to fetch all of its depending on offers
Then It should return
Offer_B , Offer_C , Offer_D
Please guide us how can we achieve this requirement to be fulfilled. Thanks in Advance !!!