syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

Question:
In Aerospike, how to create index?

Aerospike just gave me an error when I tried to query test.cats:
aql> SELECT * FROM test.cats WHERE age BETWEEN 1 AND 10
Error: (201) AEROSPIKE_ERR_INDEX_NOT_FOUND


I needed to create a secondary index on age:
-- ~/ks/b/asp/create_index.aql

-- Create cats:
INSERT INTO test.cats(PK, name, age) VALUES (100, 'Chester', 4)

-- CREATE INDEX:
CREATE INDEX cats_n1 ON test.cats (age) NUMERIC

-- This should work now:
SELECT * FROM test.cats WHERE age BETWEEN 1 AND 10 


syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me