You are here

public static function IndexFactory::create in Elasticsearch Connector 8.2

Same name and namespace in other branches
  1. 8.7 src/ElasticSearch/Parameters/Factory/IndexFactory.php \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory::create()
  2. 8.5 src/ElasticSearch/Parameters/Factory/IndexFactory.php \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory::create()
  3. 8.6 src/ElasticSearch/Parameters/Factory/IndexFactory.php \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory::create()

Build parameters required to create an index TODO: Add the timeout option.

Parameters

\Drupal\search_api\IndexInterface $index:

Return value

array

1 call to IndexFactory::create()
SearchApiElasticsearchBackend::addIndex in src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php
Adds a new index to this server.

File

src/ElasticSearch/Parameters/Factory/IndexFactory.php, line 48

Class

IndexFactory
Class IndexFactory.

Namespace

Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory

Code

public static function create(IndexInterface $index) {
  return [
    'index' => IndexFactory::getIndexName($index),
    'body' => [
      'settings' => [
        'number_of_shards' => $index
          ->getOption('number_of_shards', 5),
        'number_of_replicas' => $index
          ->getOption('number_of_replicas', 1),
      ],
    ],
  ];
}