Server tasks can fail if index is not closed before putSettings() and re-opened after

Created on 7 October 2025, 28 days ago

Problem/Motivation

After Connect to an Elastic Cloud Hosted Deployment acting as a Search API Server by entering a Cloud ID and API key Active , sometimes changing index settings fails with the error An error occurred updating settings for index MY_INDEX. (where MY_INDEX is the name of the index).

Checking further, this is happening because Elasticsearch returns a 400 Bad Request with the reason request [/MY_INDEX/_settings] contains unrecognized parameter: [reopen] on line 361 of src/SearchAPI/BackendClient.php. Sure enough, there's a 'reopen' => TRUE parameter in the call to $this->client->indices()->putSettings().

Deleting the 'reopen' => TRUE parameter and trying again has Elasticsearch return another 400 Bad Request with the reason Can't update non dynamic settings [[...]] for open indices [[MY_INDEX/-RANDOM]].

We had been closing and re-opening the index around this call, but that went away in Connect to an Elastic Cloud Hosted Deployment acting as a Search API Server by entering a Cloud ID and API key Active . I think it might have been due to failing phpunit tests, but I can't recall. Regardless, we should revisit this.

Steps to reproduce

  1. Set up a development environment (but I used the umami_demo install profile so I would have test content).
  2. Add a Search API Index of Content , indexing the title and field_body fields.
  3. Try to index content . You see the error Couldn't index items. Check the logs for details

Proposed resolution

Try closing and re-opening the index around the call to $this->client->indices()->putSettings().

Try deleting the 'reopen' => TRUE parameter in the call to $this->client->indices()->putSettings()

Remaining tasks

  1. - @mparker17 created !151 in #2
  2. Review and feedback
  3. RTBC and feedback
  4. Commit
  5. Release

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Needs review

Version

8.0

Component

Code

Created by

🇨🇦Canada mparker17 UTC-4

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024