Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
Cheshire-Cat
-
None
-
1
Description
At present N1QL predicates are open ended i.e comparisons are done across types and qualify documents vs FTS done specific type.
INSERT INTO default VALUES("k01", {"a":10}), VALUES("k02", {"a":"abc"}), VALUES("k03", {"a":"xyz"}); |
CREATE INDEX ix1 ON default(a); |
SELECT * FROM default WHER a < "xyz"; -- you get "k01", "k02" |
Direct FTS only gives "k02" |
Due to that FTS Flex Index consider some restrictions index is considered only predicate has closed range.
https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/flex-indexes.html#ranges
Is it worth consider open ended range if customers indicate through hint (same as FTS behavior)
Example:
FROM default USE INDEX (USING FTS ONLY)
Only FTS indexes considered. None qualify error out
Index sargable open end and FTS index only gives keys on the specific type of predicate, Will not give keys if type is changed.
N1QL will follow its rules.
This is gives Flex Index queries don't need to add additional predicates. The results similar to using FTS index directly i.e. relax validation little bit.