Had the need to do this, saving the snippet here.
<?php
$query = db_select('node', 'n')
->fields('n', array('nid'))
->condition('type', 'content_type_machine_name', '=')
->execute();
while ($record = $query->fetchObject()) {
_node_index_node($record);
}