The following warns me that the field “runs.s.Sample_Name” doesn’t exist:
CREATE INDEX idx_samples ON runs ( DISTINCT ARRAY s.Sample_Name for s in Samples END );
The array I’m trying to index looks something like this (very simplified):
“Samples”: [ { “Sample_Name”: “name1”}, {“Sample_Name”: “name2”}, {etc} ]
I’m not looking to create a SELECT query, just CREATE INDEX.
The query is:
CREATE INDEX idx_samples ON runs ( DISTINCT ARRAY s.Sample_Name for s in Samples END );
I’m trying to make an index on the array “Samples” in bucket “runs”. The Samples array has field “Sample_Name”. I followed the example in that link already. Every time I follow examples exactly as they are in the documentation, there is something extra I need to do, very confusing.
My problem is that it says “runs.s.Sample_Name” doesn’t exist when I try to make the index.
Hi @Poofcakes, this was a bug in 5.0.0, and was fixed in 5.0.1.
FYI, Couchbase doesn’t have formal schemas, so it can’t give an error message if you misspell a field name. To help identify typos, the Query Workbench compares the fields used in a query with the inferred schemas. This usually identifies incorrect field names, but it wasn’t handling ARRAY expressions correctly.