Getting TimeOutException while executing quey


I am getting timeOutException (java.lang.RuntimeException: java.util.concurrent.TimeoutException) While executing Query,also there is no problem in saving object/document in database.

I have used following code to create connection

CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
this.cluster = CouchbaseCluster.create(env);
this.bucket = cluster.openBucket(“cb_bucket”);

with same connection i have no problem in saving document but getting exception while executing query
code used by for query is:
Observable query = (Observable) bucket.query(Query.simple(“SELECT * FROM cb_bucket”));

Note: I am using coucbase server 2.X version and clent 2.1.4


Query (aka N1QL) is only available in Couchbase Server 4.0, and full stable support for it comes with versions of the SDK >= 2.2.0.

Additionally, you tried to instruct the SDK to look for query service on port 8091 which is the port dedicated to Key/Value operations (another service), so that couldn’t work either.

Note that, using CB4.0 and SDK 2.2.x, you wouldn’t need queryPort nor queryEnable (default values would work).