Description

search_api attempts to clean up data related to the old server for the edited index, when changing the server of the index.

This creates a situation where you can't switch servers, because you can't access the initial server (which is the issue you are trying to get around), but you also can't use the current server in its state obviously. So search is just broken completely.

Steps
  1. create a new server, which works
    • Consider using search_api_db.

  2. set this override in settings.local.php
    • $config['search_api.index.$YOUR_INDEX']['server'] = '$YOUR_NEW_SERVER_FROM_STEP_1';
  3. disable and reenable the index $YOUR_INDEX
  4. you should now be able to index your items and then use the search functionality
Notes
  • There are many other solutions online but many don't work at all. Among them:

    1. Editing the config values and using drush cim.
    2. Editing the DB directly and clearing caches.
    3. Using a php script to bootstrap Drupal and set the new DB server.
    4. Tricking Drupal into routing the old server's search requests to the new server.