How "use keys" is used for indexed documents


I am very new to couchbase server and using couchbase 4.5 . I wanted to understand how “use keys” is used. does it do primary lookup of index or secondary lookup?

That’s more a question for the n1ql section, but I’ll answer it anyway: USE KEYS 'foo' does a primary lookup (that would be very similar to a bucket.get("foo") using the SDK).

Note that “primary lookup” here does not mean primary index. No index is used at all with USE KEYS.

ah right, thanks for making that clearer @geraldss

1 Like