I'm having trouble getting SQLite to index an expression. Specifically, I want to create an index on a particular property in a JSON object.
CREATE TABLE test (tags JSON);
INSERT INTO test VALUES(JSON_OBJECT('someKey', 'someValue'));
CREATE INDEX test_idx ON test(JSON_EXTRACT(tags, '$.someKey'));
EXPLAIN QUERY PLAN SELECT JSON_EXTRACT(tags, '$.someKey') FROM test;
This query plan says:
SCAN TABLE test
What I'm expecting is some sort of SEARCH TABLE test USING INDEX...
.
Any thoughts on how I can correct this?