Nested or Parent/child

Hi all,

I need to index a four level parent / child relationship like this :

  • 1st level document
  • 2nd level document
    • 3rd level document
      • 4th level document
    • 3rd level document
      • 4th level document

One more constraint is that children shoud be attached to parents incrementally when new data are detected (csv files)

What is the best way to achieve this, and pro/cons, between nested documents and parent/child relationship ?

Is it even possible to have a multi-level relationship with nested documents ?

Thank you

How many documents at each level do you expect to have? Are these documents frequently updated or immutable?

Hi Christian,

Thanx for answering.

1st level documents are the most numerous (about 1000 a day)
Each 1st level document has up to 3 2nd level documents
Each 2nd level document has up to 4 3rd level documents
Each 3rd level document has only one 4th level document (maybe merge can be done to prevent 4th level)

The documents are immutable but as I said, sub-levels are attached to parents when data are available (from couple of hours to couple of days).

That is only 12000 (24000 if levels 3 and 4 are not merged) documents per day if I have calculated correctly. At that scale I suspect the best approach will depend on how you need to query the data.

Thanks again Christian.

Our queries results are the complete hierarchy of first level documents matching the specified search filters.

These search filters can be :

  • a full text search criteria on every property of every level document
  • and/or specific criteria (constant score term or date range) on some properties of first level documents, some other properties of second level documents and so on on each level

Hi Christian and others,

Any advice about using nested objects or parent/child relationship based on the specifications I gave ?

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