What is the View query keys size limit


I am using Java API, 2.1.2, and the server, 3.0.1.

After sending approximately 75-100 keys to a query, each key size was around 15 chars, I get an error.
The error wasn’t clear but after splitting the keys to two different requests - the query passes successfully.
The error I got inside the result: “{“errors”:[{“error”:“bad_request”,“reason”:“invalid UTF-8 JSON: {{error,{9,“lexical error: invalid char in json text.\n”}},\n <<”{\“keys\”: …”

I am trying to understand what is the limitation on the amount of keys in a single query when passed as a JsonArray

See the code snippet below:

JsonArray emailArray = JsonArray.from(myArray);
ViewResult result = bucket.query(ViewQuery.from(viewDesign, viewName).keys(emailArray));
if (!result.success()){
    throw new Exception("view query fail, view name: " + viewName);

Is there a known limitation on the amount of keys? are there any known best practices I’m missing?


Actually that looks like a bug in the SDK. Can you raise an issue here? http://www.couchbase.com/issues/browse/JCBC

I open a Jira: https://issues.couchbase.com/browse/JCBC-766

i saw that the limit is around 2k chars.


1 Like

Thank you! Let’s take it from there