If I want to create the hash on a particular token(I don’t know which token it is an element that is not an object just a list of Strings) would it be like
CREATE INDEX idx_Token ON employee(name,profession,address, tokens) PARTITION BY hash(tokens)
or would the BY hash(tokens.<somethingHere>) need to be the format?
HASH expression must be immutable . Expression can be ANY data type (including array or object). It considers expression as scalar and calculate HASH. You can use META().id.
You need to use Array Indexing and if you want Partition Index for Divide and Concur you can use META().id as partition key. The following gives overview and help understand how partition works. https://blog.couchbase.com/couchbase-gsi-index-partitioning/
CREATE INDEX `idx_Token` ON `employee` ( DISTINCT tokens ) PARTITION BY hash( META().id);
SELECT *
FROM employee
WHERE ANY token IN tokens SATISFIES token IN ["1234"] END;
Last question on this for now in the query above we get all the data as wanted, now if we wanted the data to only be that reflected of by that of the token value how would we do that.
For example the query:
SELECT *
FROM employee
WHERE ANY token IN tokens SATISFIES token IN [“1234”] END;