hint indexes for $or clauses

According to the MongoDB documentation, I have created indexes for fields used in $or queries. Most of the time, these queries work as expected, utilizing the appropriate indexes. However, occasionally, I encounter the following error:


multiplanner encountered a failure while selecting best plan :: caused by :: operation exceeded time limit

Is there any way to avoid this issue? I searched for how to use $hint but found that $hint cannot support hinting multiple indexes for this situation. The query predicates are the same, only the parameters are different.


mongodb version 4.4
I appreciate any help and suggestions!

Thank you very much!