Suppose I have created secondary indexes on bin1 and bin2.
And I query using Java client as :
Statement stmt = new Statement();
stmt.setNamespace("test");
stmt.setSetName("myDemoSet");
stmt.setBinNames("bin1", "bin2", "bin3", "bin4", "bin5");
stmt.setFilters(Filter.equal("bin1", Value.get("sherlock")));
RecordSet rs = null;
try {
rs = client.query(null, stmt);
} catch (AerospikeException e) {
e.printStackTrace();
}
This works. But if I add another filter :
stmt.setFilters(Filter.equal("bin1", Value.get("sherlock")), Filter.equal("bin2", Value.get("stackoverflow")));
It doesn't seem to have any effect on the output.
So is multiple filters supported currently by Aerospike Java Client?
If so, how ?
Old Answer: Currently you can only do a single predicate on a secondary index, either equals or between.
Update: Predicate filtering was added in release 3.12. You can use the PredExp class of the Java client (see examples).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With