What can I do to avoid exceeding the max_clause_count limit in match queries?

In our search, span_near was previously used for distance search with term queries, but this led to a smaller sample than I would like, I moved the implementation to IntervalQuery with match, but now an error is being issued about reaching the max_clause_count limit, is it possible to fix this problem using the match query parameters?