Recently I investigated an issue where a customer was using SharePoint 2013 Search REST APIs and making a post request to get results from SharePoint 2013. The query worked just fine. They also had good number of filters (properties) the end-users can use and they were using the HiddenConstraints property to filter the search results based on what the end-user selects.
The problem was that whenever the list of filters increased beyond a point, we hit the following error:
We were able to figure out that this length (in KB) is governed by a property called MaxKeywordQueryTextLength of the search service application (also in KeywordQueryProperties). Luckily the MaxKeywordQueryTextLength property is “settable” using SharePoint 2013 Management Shell and we increased the value from 4 KB to 8 KB using the below commands.
This change helped in fixing the error “The maximum allowed value is 4096” in this specific scenario.
NOTE that the value for MaxKeywordQueryTextLength can be increased to up to 20 KB ($search.MaxKeywordQueryTextLength = 20480). Increasing this value beyond 20 KB is not supported.
Here are a few references to leverage SharePoint 2013 Search REST APIs.
Good luck with searching using SharePoint 2013 Search REST APIs!