CPU usage high for `cms-worker` - elasticsearch error - maxClauseCount is set to 1024

@braden @dave
It appears that someone else had this too_many_clauses: maxClauseCount is set to 1024 issue.

They ended up modifying the elasicsearch Docker service configuration to 4096 size.

version: "3.7"
services:

  elasticsearch:
    environment:
      - indices.query.bool.max_clause_count=4096

We’re using Amazon OpenSearch Service instead of elasticsearch and therefore we need to alter this using

ChatGPT (ChatGPT - Elasticsearch maxClauseCount config) mentions doing this.

Amazon OpenSearch Service (previously Amazon Elasticsearch Service) does not allow direct modification of elasticsearch.yml, but you can update maxClauseCount dynamically using the OpenSearch API.

Update maxClauseCount in Amazon OpenSearch Service

Since Amazon OpenSearch runs in a managed environment, you must use the _cluster/settings API to modify indices.query.bool.max_clause_count.

1. Increase maxClauseCount Dynamically

Run the following request using cURL, Kibana (Dev Tools), or AWS OpenSearch API:

PUT _cluster/settings
{
  "persistent": {
    "indices.query.bool.max_clause_count": 4096
  }
}

This change will persist until the cluster is restarted.

2. Verify the New Setting

After applying the change, confirm the update using:

GET _cluster/settings

3. Make It Permanent

Amazon OpenSearch does not allow modifying elasticsearch.yml, so you must set this value dynamically after every cluster restart. If frequent restarts occur, consider automating this API request using AWS Lambda or a similar approach.