public static function IndexFactory::index in Elasticsearch Connector 8.5
Same name and namespace in other branches
- 8.7 src/ElasticSearch/Parameters/Factory/IndexFactory.php \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory::index()
- 8.2 src/ElasticSearch/Parameters/Factory/IndexFactory.php \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory::index()
- 8.6 src/ElasticSearch/Parameters/Factory/IndexFactory.php \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory::index()
Build parameters required to index.
TODO: We need to handle the following params as well: ['consistency'] = (enum) Explicit write consistency setting for the operation ['refresh'] = (boolean) Refresh the index after performing the operation ['replication'] = (enum) Explicitly set the replication type ['fields'] = (list) Default comma-separated list of fields to return in the response for updates.
Parameters
\Drupal\search_api\IndexInterface $index: Index to create.
bool $with_type: Should the index be created with a type.
Return value
array Associative array with the following keys:
- index: The name of the index on the Elasticsearch server.
- type(optional): The name of the type to use for the given index.
4 calls to IndexFactory::index()
- IndexFactory::bulkDelete in src/
ElasticSearch/ Parameters/ Factory/ IndexFactory.php - Build parameters to bulk delete indexes.
- IndexFactory::bulkIndex in src/
ElasticSearch/ Parameters/ Factory/ IndexFactory.php - Build parameters to bulk delete indexes.
- IndexFactory::mapping in src/
ElasticSearch/ Parameters/ Factory/ IndexFactory.php - Build parameters required to create an index mapping.
- SearchBuilder::build in src/
ElasticSearch/ Parameters/ Builder/ SearchBuilder.php - Build up the body of the request to the Elasticsearch _search endpoint.
File
- src/
ElasticSearch/ Parameters/ Factory/ IndexFactory.php, line 37
Class
- IndexFactory
- Create Elasticsearch Indices.
Namespace
Drupal\elasticsearch_connector\ElasticSearch\Parameters\FactoryCode
public static function index(IndexInterface $index, $with_type = FALSE) {
$params = [];
$params['index'] = IndexFactory::getIndexName($index);
if ($with_type) {
$params['type'] = $index
->id();
}
return $params;
}