How to save persistent data structure into elastic search

Viewed 58

I have a relational DB, and it saved a persistent segment tree structure, means all parent and children are always manyToMany, the height of this tree is about 4 to 5 levels

Persistent segment tree reference: https://www.geeksforgeeks.org/persistent-segment-tree-set-1-introduction/

Because it is segment tree, node data won't change much, when it changed, there should be another node generated

My questions is which way I should save my data into elastic search.

My current thought:

  1. nested will build too many documents, anything changes from leaf node will generate a new root, and in new root, will make a lot of redundant data, because a lot of un-versioned nodes are not changed, and it is hard to trace node versioning
  2. parent-child mode looks good fit, however each node may have multiple parents and children, this many-to-many relationship is almost everywhere from my DB, denormalize it seems impossible, the solution that I could think of is maintaining children and parents IDs from each level, but it makes so hard to maintain, plus join might make it slow

Please enlight me with your ideas.

0 Answers
Related