Recommendation on multi level hierarchial structure with arrays

I have a complex data structure that I would want to index in Elastic.
Its a multi level structure with arrays. What's the best way to model it ?

For example,

{
"Organization": "MyOrg",
"Business Units": [
{
"Name": "Sales",
"Location": "SanJose",
"Employees": [
{
"Name": "George",
"Age": "50"
},
{
"Name": "John",
"Age": "30"
}
]
},
{
"Name": "IT",
"Location": "NewYork",
"Employees": [
{
"Name": "Smith",
"Age": "45"
},
{
"Name": "Clark",
"Age": "25"
}
]
}
]
}

  • You should probably consider denormalizing your data somewhat.
  • You might consider 'join' fields to relate Employee to BusinessUnit maybe (there's a fair bit to consider if you do this though, so tread lightly)

By the way, formatting your code so it's indented makes it a lot easier for others to parse it and provide help.

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