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

Command icon 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

sokru created an issue. See original summary.

sokru’s picture

Assigned: sokru » Unassigned
Status: Active » Needs review

The 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.

kim.pepper made their first commit to this issue’s fork.

  • kim.pepper committed 33386c46 on 3.x authored by sokru
    Issue #3471470 by sokru: entity.search_api_index.canonical route will...
kim.pepper’s picture

Status: Needs review » Fixed

Although 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!

  • kim.pepper committed b7baf3e7 on 2.x authored by sokru
    Issue #3471470 by sokru: entity.search_api_index.canonical route will...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.