Zero result with n1ql query with java sdk, where rest api gives results

I have three node couchbase cluster

couchbase :
java sdk client : 2.4.2

JsonObject queryParams = JsonObject.create();
Expression expression = x("type").eq("category");
queryParams.put("name", "nameVal");
queryParams.put("lo_createdDate", 1492648094000);
queryParams.put("hi_createdDate", 1492730894000);

N1qlParams n1qlParams =;

Statement statment = select(*).from("bucketname").where(expression).limit(100).offset(0)

N1qlQuery query = N1qlQuery.parameterized(statement, queryParams, n1qlParams);

List<T> resultList = new LinkedList<>();
try {
			.doOnError(err -> {
				throw Exceptions.propagate(err);
			.flatMap(result -> {
                        .subscribe(errMsgJson -> {
                            log.error(LogConstants.N1QL_ERROR+ errMsgJson);
                return result.rows();
			.map(row -> {
				try {
					return readRow(row);
				} catch (Exception e) {
					log.error("Failed converting to object in multi get exception {}", e);
					throw Exceptions.propagate(e);
}catch (Exception e){
	throw new DataAccessException(LogConstants.DATABASE_ERROR);

Sometimes not able to get any records.
If I do query with REST it gives me result with correct records.

Is there any mistake here?

Thanks in advance
Nihar Rathod

Does it make any difference with adhoc set to false?

Actually, I tried with adhoc(false) and hit bug .
So I put it as true.

Thanks for Quick response. :slight_smile:

Should I use older java sdk client? for compatibility

Nihar Rathod

I suggest you ask that question on the Java SDK forum.

Sorry, It was my mistake. Couchbase is working fine :slight_smile:

Nihar Rathod