Trigger a module function after a node is saved or updated successfully in the database
You may be able to use Hook Post Action and then use this hook:

function my_module_node_postinsert($node) {
  if(!$node-&gt;type == 'article' || !$node-&gt;type == 'page' ) 
      return;
  my_module_do_index($node) ; // indexes the node
}


Give it a try and see if it helps!

The project link: https://www.drupal.org/project/hook_post_action