Question about hierarchy structure in Algolia

I’m trying to index structures somewhat similar to entities in Notion - Directory and Page. That is, directory can be nested. Given A, B, C, D directories and E page,

    A
  /   \
 B     C
 |
 D
 |
 E

if name of Directory D name changes X then searching Page E should also show updated path (in this case breadcrumb should something like A > B > X > E. How could we achieve this in scale? for example, there could be 100 pages under Directory D and once it has changed to X, every pages under X should also have updated path name A > B > X > (Something)