Elasticsearch & Lucene (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
Parent-Child (`join` field) vs Nested Objects (`nested` type): Architectural tradeoffs.
senior LevelelasticsearchAdvanced Internals
In Simple Words:
nestedObjects: Flat arrays of objects are indexed as separate hidden Lucene documents stored in contiguous disk blocks.- Fast read/query performance.
- Downside: Updating a single child item requires re-indexing the entire root parent document and all siblings!
- Parent-Child (
joinfield): Decoupled parent and child documents stored independently in the same shard:- Children can be added, updated, or deleted without touching the parent document.
- Slower query join performance (
has_child/has_parent). Ideal for 1-to-many relationships where children update rapidly (e.g. comments, bids).