linagora / tmail-flutter

A multi-platform (Flutter) application for reading your emails, with your favorite devices, using the JMAP protocol!
GNU Affero General Public License v3.0
319 stars 73 forks source link

too many clause in OpenSearch #2809

Open chibenwa opened 6 months ago

chibenwa commented 6 months ago

Description

org.opensearch.client.ResponseException: method [POST], host [https://100.96.74.153:9200], URI [/read-mailbox/_search?scroll=1m&typed_keys=true], status line [HTTP/1.1 500 Internal Server Error]
{"error":{"root_cause":[{"type":"too_many_clauses","reason":"too_many_clauses: maxClauseCount is set to 1024"},{"type":"too_many_clauses","reason":"maxClauseCount is set to 1024"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":3,"index":"mailbox_v2","node":"M1WBnL5MTLWd4DkhxpwiLA","reason":{"type":"too_many_clauses","reason":"too_many_clauses: maxClauseCount is set to 1024"}},{"shard":1,"index":"mailbox_v2","node":"3isLBh-mQT2Tr07r79OTIA","reason":{"type":"too_many_clauses","reason":"maxClauseCount is set to 1024"}}]},"status":500}
    at org.opensearch.client.RestClient.convertResponse(RestClient.java:375)

Reported on backend side.

First thought it was a backend bug linked to right management pushimg mailbox list onto the search index

But https://github.com/apache/james-project/pull/2198 failed at reproducing it and the user for who this happens only have around one hundred mailbox.

Thus I believe somewhere in the tmail app we put too many search clause.

chibenwa commented 6 months ago

Question is: what could cause the frontend to pass 1024+ filters?