You are here

protected function ElasticsearchTest::indexItems in Elasticsearch Connector 8.7

Same name and namespace in other branches
  1. 8.5 tests/src/Kernel/ElasticsearchTest.php \Drupal\elasticsearch_connector\Tests\Kernel\ElasticsearchTest::indexItems()
  2. 8.6 tests/src/Kernel/ElasticsearchTest.php \Drupal\elasticsearch_connector\Tests\Kernel\ElasticsearchTest::indexItems()

Indexes all (unindexed) items on the specified index.

Parameters

string $index_id: The ID of the index on which items should be indexed.

Return value

int The number of successfully indexed items.

Overrides ExampleContentTrait::indexItems

1 call to ElasticsearchTest::indexItems()
ElasticsearchTest::regressionTests2 in tests/src/Kernel/ElasticsearchTest.php
Regression Tests 2.

File

tests/src/Kernel/ElasticsearchTest.php, line 90

Class

ElasticsearchTest
Tests index and search capabilities using the elasticsearch backend.

Namespace

Drupal\elasticsearch_connector\Tests\Kernel

Code

protected function indexItems($index_id) {

  /** @var \Drupal\search_api\Index\IndexInterface $index */
  $index = Index::load($index_id);
  $index
    ->setOption('index_directly', TRUE);
  return $index
    ->index();
}