holmes840
holmes840

Reputation: 1073

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

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 ?

Upvotes: 5

Views: 592

Answers (1)

Ronen Botzer
Ronen Botzer

Reputation: 7117

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

Upvotes: 6

Related Questions