We all know that, whenever we save any item or publish it, index for the item (sitecore_master_index or sitecore_web_index) gets updated, not rebuild. But there are certain cases, you might require dependent items or child items or parent items need to be updated in the index.
There is a pipeline to achieve this functionality “indexing.getDependencies”, which is present in Sitecore.ContentSearch.config file.
There are already two processors available GetCloningDependencies & GetDatasourceDependencies, by default disabled. But, if you require any new processor to introduce, need to derive from BaseProcessor, and patch the same through configuration.
Here is nice blog post about how to write custom processor,
https://ggullentops.blogspot.com/2016/06/sitecore-index-dependencies.html
Happy Learning 🙂