Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aerospike : Does Java Client support mulitple filters on secondary indexes?

Tags:

java

aerospike

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 ?

like image 283
holmes840 Avatar asked Dec 05 '14 10:12

holmes840


1 Answers

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).

like image 158
Ronen Botzer Avatar answered Oct 20 '22 10:10

Ronen Botzer