Problem/Motivation
Similar to #3187670: entity.search_api_index.canonical route will produce fatal error when backend is down. Vising entity.search_api_index.canonical route when backend is down, will provide a fatal error
OpenSearch\Common\Exceptions\NoNodesAvailableException: No alive nodes found in your cluster in OpenSearch\ConnectionPool\StaticNoPingConnectionPool->nextConnection() (line 68 of /var/www/html/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php).
Steps to reproduce
1. Create server and index.
2. Shut down search backend, e.g. sudo service opensearch stop or change the connector url port to some non-existing eg: $config['search_api.server.opensearch']['backend_config']['connector_config']['url'] = "http://localhost:9999"
3. Go to /admin/config/search/search-api/index/{index_name}
Proposed resolution
Use try/catch method when connecting the backend.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork search_api_opensearch-3471470
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
sokru commentedThe solution is from referenced issue. Elastcsearch-php library has open issue to make the client report better on connection errors. Not sure if Opensearch-php library has yet a open issue.
Comment #6
kim.pepperAlthough the code looks copy/pasted from the elasticsearch_connector module, I think it's ok.
I think it's valuable to add a functional test too as we don't have one currently.
Committed to 3.x. Thanks!