Global secondary index (GSI) for couchbase lite

n1ql
index

#1

I am trying to build a android mobile app. I prefer using GSI instead of views for easier and faster querying with n1ql. Any idea how to use GSI with couchbase lite?


#2

GSI cannot be used with Couchbase Lite. It is fundamentally incompatible with an embedded mobile library because GSI is a separate server process running in cooperation with the main process. Couchbase Lite 2.0 does not use views anymore so maybe that will be of interest?


#3

I have about 200 000 records that need to be searched through very quickly. Does the default indexing support n1ql queries? if not, is there a indexing method that can be used with n1ql queries.
How would these affect app’s performance in ‘expensive’ searches like wildcard search are used


#4

N1QL is also a strictly server side technology that relies on having a separate process (and GSI, actually). 2.0 introduced the new Query API that is similar to N1QL but doesn’t have all features and is not string based. I don’t have an answer for how an app’s performance will be affected because I suppose it would depend on the situation it is being used in. The best way to find out would be to write a POC.


#5

Does the new Query API use any indexing mechanism or can we configure indexing for this?


#6

You can add an index on certain key paths but it’s not the same as GSI. All you can specify is the key path and it will make your ordering / comparison faster.


#7

Check out this intro blog on Query APIs in Couchbase Lite 2.0