How to pass multiple PK in the AQL Select query?

How to pass multiple PK in the AQL Select * from namespace.setName where PK command?

You can use or split to pass multiple PK parameters, like this

select * from namespace.setName where PK="pk1" or PK="pk2"

No… nothing is parsed by aql beyond the first PK=“pk1”

aql> select * from test.testset where pk="key1"

+--------+-----+

| name | age |

+--------+-----+

| "Jack" | 26 |

+--------+-----+

1 row in set (0.001 secs)

OK

aql> select * from test.testset where pk="key1" and then everything else is just ignored

+--------+-----+

| name | age |

+--------+-----+

| "Jack" | 26 |

+--------+-----+

1 row in set (0.001 secs)

OK

How would you perform an ‘OR’ statement on a bin?

select * from insurance.bar where policyValid=1 or policyValid=9

for:

aql> select * from insurance.bar
+-------------+---------+
| policyValid | comment |
+-------------+---------+
| 9           | "Dead"  |
| 1           | "Live"  |
+-------------+---------+

You have to write your own application, for example in Java using Aerospike Java client library, and use scan with Expressions. See similar discussion for writes in this thread. Aerospike Quick Look (AQL) - an application that uses Aerospike C client library, is not designed to provide full C client functionality.

1 Like