How to reindex indexer programmatically in magento 2?

Just create PHP file under your module’s Cron folder,
A created module like Rbj_Indexing for reference, Create Indexer.php file and call execute() function,

<?php
namespace Rbj\Indexing\Cron;

class Indexer
{
    public function __construct(
        \Magento\Indexer\Model\Processor $processor
    ) {
        $this->processor = $processor;
    }

    public function execute()
    {
        /* Regenerate indexes for all indexers */
        $this->processor->reindexAll();

        /* Regenerate indexes for all invalid indexers */
        $this->processor->reindexAllInvalid()
    }
}

There are two types of method for indexing.

1. Regenerate indexes for all indexers
$this->processor->reindexAll();

2. Regenerate indexes for all invalid indexers. This will only regenerate for invalid indexer.
$this->processor->reindexAllInvalid()