Partial index creation (where condition) in Couchbase Java SDK 3.0

How to create partial index (with where condition in the index) by using Couchbase Java SDK 3.0?

I was referring the below for the com.couchbase.client.java.manager.query.QueryIndexManager & com.couchbase.client.java.manager.query.CreateQueryIndexOptions from the below link. I couldn’t see any op[tion to include where clause.
https://docs.couchbase.com/sdk-api/couchbase-java-client/

1 Like

Hi Ramesh,

I looked at the Index manager API and I don’t see a way to specify a WHERE clause. Thanks for reporting this omission. I’ve filed JCBC-1629 to track the issue.

Thanks,
David

Hi Ramesh,
I’ve since learned that the omission is intentional. Apparently there are a great many options for index creation, and it was decided that the index management API should only support the most common options.

The good news is that it’s relatively easy to create an index using the Query API. (In fact, the Index Management API uses the Query API behind the scenes). Here’s the documentation for the CREATE INDEX query command:

https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/createindex.html

Thanks,
David