Error 400 while filtering a view using Java SDK

Hi I want to filter my query using Java Couchbase SDK by using startKey end endKey properties of View.

I want to use the keys below

[ “AEL”, “12345678”, “1601020600”]
[ “AEL”, “12345678”, “1601020800”]

You can see my Java code below

bucket.query(ViewQuery.from(“design”, “view”).reduce(false)
.startKey(JsonArray.from(“AEL”, “12345678”, “1601020300”))

After I run this code I get the error below;

INFO 8604 — [-computations-5] c.c.client.java.view.ViewRetryHandler : Received a View HTTP response code (400) I did not expect, not retrying.

What could be the reason of this error?

I’m not sure what is going on. If the design doc and view didn’t exist, you’d get a meaningful exception (eg ViewDoesNotExistException)…
Can you enable logging at TRACE level and show the output? That will trace packets and we’ll be able to see if there is a particular message attached to the HTTP 400 error.

It looks like I added “descending(true)” property to the view. It was the cause of the problem. After I deleted it, query started to work

Thank you for your help.

Oh. Did the error() method return anything though?

Yes. It returns the error below;

{“errors”:[{“error”:“query_parse_error”,“reason”:“No rows can match your key range, reverse your start_key and end_key or set descending=false”}]}

Looks like error occurs when I try to order the results. Something about ordering keys between my start and and key. Maybe it is about structure of the keys which are json arrays.