Skip to content
Snippets Groups Projects
Commit 34b2b456 authored by Kalle Vuorjoki's avatar Kalle Vuorjoki
Browse files

Issue #3153850 by sokru, littlepixiez, Roderik de Langen, IT-Cru: Make sure we...

Issue #3153850 by sokru, littlepixiez, Roderik de Langen, IT-Cru: Make sure we are dealing with an Elasticsearch backend on IndexFactory
parent 32525977
No related branches found
No related tags found
3 merge requests!39Issue #3279558: Support ElasticSearch 8,!37Issue #3175898 by sokru, skek, robertoperuzzo, IT-Cru, Renrhaf: Port issue...,!4Make sure we are dealing with an Elasticsearch backend on IndexFactory
......@@ -2,6 +2,7 @@
namespace Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory;
use Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend;
use Drupal\search_api\IndexInterface;
use Drupal\elasticsearch_connector\Event\PrepareIndexEvent;
use Drupal\elasticsearch_connector\Event\PrepareIndexMappingEvent;
......@@ -229,6 +230,12 @@ class IndexFactory {
*/
public static function getIndexName(IndexInterface $index) {
$backend = $index->getServerInstance()->getBackend();
// Make sure we are dealing with an Elasticsearch backend.
if (!$backend instanceof SearchApiElasticsearchBackend) {
return '';
}
// Get index machine name.
$index_machine_name = is_string($index) ? $index : $index->id();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment