If you want to use N1QL to query you need to create an index to query, at least a primary index.
If you just want to get it back out by ID there is no need for n1ql, then you use the get method on your API.
You can access the data in the buckets directly (without an index) if you know the document keys.
SELECT * FROM test-bucket t
USE KEYS [“k1”, “k2”, “k3”]
WHERE t.a = 10 and t.b = “Hello”;
If you want to access the data WITHOUT knowing the keys, you do need to createa a PRIMARY INDEX to experiment with. You can optimize this by creating the index on the fields you’re filtering on…
PRIMARY INDEX: CREATE PRIMARY INDEX ON test-bucket;
Secondary indices: CREATE INDEX i1 ON test-bucket(c1, c2);