Can't get array index to work

Once again I don’t know what I’m doing wrong.

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} ]

What is Query? The right query is

SELECT META().id FROM runs WHERE ANY s IN Samples SATISIFIES s.Sample_name = “name1” END;

Checkout https://developer.couchbase.com/documentation/server/current/n1ql/n1ql-language-reference/indexing-arrays.html

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.

Where are you getting error. create index will not give above error.

I didn’t say it errored, I just said it warned me.

It is warning you can ignore it. cc @eben

Alright thank you, sorry for the inconvenience.

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.