Ré indexer Search API par le code

Ré indexer tout Search API 

  1. use Drupal\search_api\Utility\CommandHelper;
  2.  
  3. $command_helper = new CommandHelper(\Drupal::entityTypeManager(), \Drupal::moduleHandler(), 'dt');
  4. $command_helper->setLogger(\Drupal::logger('search_api'));
  5. $command_helper->resetTrackerCommand();
  6. $command_helper->indexItemsToIndexCommand();

Ré indexer un id spécifique

ici notre id sera eleasticsearch_index

  1. use Drupal\search_api\Utility\CommandHelper;
  2.  
  3. $command_helper = new CommandHelper(\Drupal::entityTypeManager(), \Drupal::moduleHandler(), 'dt');
  4. $command_helper->setLogger(\Drupal::logger('search_api'));
  5. $command_helper->resetTrackerCommand(['eleasticsearch_index']);
  6. $command_helper->indexItemsToIndexCommand(['eleasticsearch_index']);

 

Drupal Search API

Ajouter un commentaire

Image CAPTCHA
Saisir les caractères affichés dans l'image.