Algorithm to search tree-like structured relational data (use example: elasticsearch)
You needn't use nesting in this case, you can use your flatten list, make the field at lowest level as your index/primary key and each of its parent as a field, so your entries will become
"canary":{ "l1":"living creatures", "l2":"carnivore", "l3":"bird",}"dolphin":{ "l1":"living creatures", "l2":"fish",}"Penguin":{ "l1":"living creatures", "l2":"fish, bird", "##assuming penguin is both}
Then when u need to disable the entry, you can simply disable any document that has bird in it, of course data is repeated but that's noSQL