Is there an equivalent to SQL IN clause for secondary index?


I’m trying to see if there’s an equivalent of SQL IN clause while querying on a secondary index. For e.g. I’ve a secondary index on “name” field. Can I construct a query where I can retrieve all records where name IN (“abc”, “def”, “ghi”, “jkl”) ?

Regards, Shamik

Aerospike can do equals for string bins and equals or range for numeric bins but the client drivers do not support multiple filters so you cannot do multiple equals in a single query.

You can do this by writing a Lua UDF. You can pass all the values and the UDF will scan all the records and do the filtering logic you need, like checking multiple bins or multiple values for a single bin.

More info in documentation:

and other threads: