Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sonnykt/396bd4324fc6659baafd0923a98abf7a to your computer and use it in GitHub Desktop.
Save sonnykt/396bd4324fc6659baafd0923a98abf7a to your computer and use it in GitHub Desktop.
Drupal 10 - debug Elasticsearch connector
use Drupal\search_api\Entity\Index;

$index = Index::load('node')
$server = $index->getServerInstance()
$backend = $server->getBackend()
$backend->getCluster()

$cluster_manager = \Drupal::service('elasticsearch_connector.cluster_manager')
$clusters = $cluster_manager->loadAllClusters()
$cluster = $clusters['elasticsearch_bay']
$cluster->getRawUrl()

$client_manager = \Drupal::service('elasticsearch_connector.client_manager')
$client = $client_manager->getClientForCluster($cluster)
$client->indices()
$client->getIndicesStats()

$index_factory = \Drupal::service('elasticsearch_connector.index_factory')
$index_factory->getIndexName($index)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment