How to execute dynamic n1ql query with Spring data CouchbaseTemplate

I am migrating spring data couchbase to 4.*

With previous version, I used to execute dynamic N1Ql query like below
N1qlQueryResult result = couchbaseTemplate.queryN1QL(N1qlQuery.simple(complexStringQuery));

Now with upgrade, I see queryN1QL is removed and we are supposed to use findByQuery.
But findByQuery does not take string query.

How can I achieve this with newer spring data couchbase version.

Thank You for your help


If you want to do your own queries then you have to use the Java SDK directly with the Cluster object, like in this example. You can see more detail on this querying in the Java 3.x SDK documentation.

There also some guidance on migrating from Spring Data Couchbase 3.x to 4.x that may assist you.

Hope this helps,