You can use this code based on : Magento\Indexer\Controller\Adminhtml\Indexer\MassChangelog
foreach ($indexerIds as $indexerId) {
/** @var \Magento\Framework\Indexer\IndexerInterface $model */
$model = $this->_objectManager->get('Magento\Framework\Indexer\IndexerRegistry')->get($indexerId);
$model->setScheduled(true);
}
IndexerIds can be retrieve on the code or by Magento command :
design_config_grid Design Config Grid
customer_grid Customer Grid
catalog_category_product Category Products
catalog_product_category Product Categories
catalog_product_price Product Price
catalog_product_attribute Product EAV
catalogrule_rule Catalog Rule Product
catalogrule_product Catalog Product Rule
cataloginventory_stock Stock
catalogsearch_fulltext Catalog Search
targetrule_product_rule Product/Target Rule
targetrule_rule_product Target Rule/Product
salesrule_rule Sales Rule