Error: Bad Request when search

From time to time i got the following error when trying to search on Dashboards:

Error: Bad Request
    at Fetch._callee3$ (http://opensearch.fm.com/1/bundles/core/core.entry.js:6:59862)
    at tryCatch (hhttp://opensearch.fm.com/1/bundles/plugin/queryWorkbenchDashboards/queryWorkbenchDashboards.plugin.js:1:33827)
    at Generator.invoke [as _invoke] (http://opensearch.fm.com/1/bundles/plugin/queryWorkbenchDashboards/queryWorkbenchDashboards.plugin.js:1:37778)
    at Generator.next (http://opensearch.fm.com/1/bundles/plugin/queryWorkbenchDashboards/queryWorkbenchDashboards.plugin.js:1:34966)
    at fetch_asyncGeneratorStep (http://opensearch.fm.com/1/bundles/core/core.entry.js:6:52965)
    at _next (http://http://opensearch.fm.com/1/bundles/core/core.entry.js:6:53281)

Dashboard container log:

{"type":"log","@timestamp":"2022-04-07T07:54:21Z","tags":["error","opensearch","data"],"pid":1,"message":"[search_phase_execution_exception]: all shards failed"}                   
{"type":"response","@timestamp":"2022-04-07T07:54:21Z","tags":[],"pid":1,"method":"post","statusCode":400,"req":{"url":"/internal/search/opensearch","method":"post","headers":{"hos
t":"opensearch.fm.com","content-length":"1482","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537
.36 Edg/95.0.1020.30","osd-version":"1.3.0","content-type":"application/json","accept":"*/*","origin":"http://opensearch.fm.com","referer":"http://opensearch.fm.com
/app/discover","accept-encoding":"gzip, deflate","accept-language":"en-US,en;q=0.9"},"remoteAddress":"0.0.0.1","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWeb
Kit/537.36 (KHTML, like Gecko) Chrome/0.0.0.0 Safari/537.36 Edg/0.0.0.0","referer":"http://opensearch.fm.com/app/discover"},"res":{"statusCode":400,"responseTime"
:40,"contentLength":9},"message":"POST /internal/search/opensearch 400 40ms - 9.0B"} 

The solution is to delete the index and create it again but it’s not the best solution.
Does anyone knows what is the reason for the error and how to avoid it?

Thank you

I solved it.
The issue was the value in docker-compose:
indices.query.bool.max_clause_count=1024

I increase it and it solved the issue.