Status of my cluster is showing as green, but when I try to add server in Search API I get the following error:
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\search_api\SearchApiException</em>: Cannot load the Elasticsearch cluster for your index. in <em class="placeholder">Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend-&gt;__construct()</em> (line <em class="placeholder">202</em> of <em class="placeholder">modules/contrib/elasticsearch_connector/src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php</em>).

Comments

realityloop created an issue. See original summary.

dimaboychev’s picture

Make sure to have at least one default active cluster. When creating an elasticsearch cluster "Make this cluster default connection" should be checked.

grimreaper’s picture

Version: 8.x-5.0-alpha2 » 8.x-5.0-alpha3

Hello,

I have the same issue in the same situation.

Looking into the code, the problem is that the default cluster is loaded using a state which stores the ID of the default cluster.

So in a team of developers or across different environments, only the config is deployed, not the states. So the state is not set for another developer or another environment.

A workaround is to resave the cluster configuration to have the state set. But this is not very DX friendly, and the use of a state should be avoided to detect the default cluster.