Key limit in View queries?

I’m querying a view using the PHP SDK using the view method, $object->view($ddocname [, $viewname ] [, $viewoptions ]), and finding that when I pass in a certain number of keys in the viewoptions param, the method silently fails and just returns null. It appears that 164 keys is OK, but 179 is not. I didn’t see documentation indicating a key limit and would expect an error if there were.
Here’s the call:
// 179 keys breaks, 164 OK
$result = $this->cb->view(self::VIEW_DAP,‘modelcount’,array(‘keys’ => $keys,
‘group_level’ => 2,
‘group’ => true,
‘skip’ => 0)
Is there a known limit for the keys array?

Just a guess, but you could also be running into URI length limitations. Depending on your server configuration or proxies, URIs could be limited to lengths as short as 1024 chars. I recommend you take a look at the http network traffic and see if your request is being truncated.

The httpd server used by Couchbase (Mochiweb) has some hard limit for URI lengths, which if I recall correctly is around 4Kb or 8Kb.
To overcome this limitation, it’s possible to issue an HTTP POST to query a view instead of issuing an HTTP GET request. Works exactly the same way as the GET except that you don’t specify the keys in the URL but instead in the body of the POST request, like this:
{“keys”: [“key1”, “key2”, 123, …]}
The Content-Type of the request should also be application/json.
I don’t know however if the PHP SDK (or any other SDK) allows to choose a POST instead of a GET. If it doesn’t, or you can’t find a way to do it, open an issue in Couchbase’s JIRA and link it to this thread.

Thanks for both your replies. I did Wireshark capture and it looks like the PHP SDK does a direct socket connect to Couchbase on port 8092 and then streams HTTP-like GET requests over that connection. So I suspect I am indeed hitting the Couchbase GET limit. Unfortunately there are no options that I see for telling the SDK to use POST instead of GET. I’ll go post a bug on JIRA.

Thanks Robert for creating the following JIRA :