Trying multiple filter in the statement but it doesnt work.
throwing exception com.aerospike.client.AerospikeException: Error Code 4: Parameter error
Here is the code
Statement statement = new Statement();
statement.setNamespace(namespace);
statement.setSetName(“set1”);
statement.setBinNames(“bin1”,“bin2”);
statement.setFilters(Filter.equal(“type”, “gal”),Filter.equal(“refid”, "1));
RecordSet rs = asi.client.query(null, statement);
It works If I try with single filter value.
Statement statement = new Statement();
statement.setNamespace(namespace);
statement.setSetName(“set1”);
statement.setBinNames(“bin1”,“bin2”);
statement.setFilters(Filter.equal(“type”, “gal”));
RecordSet rs = asi.client.query(null, statement);
Getting exception for multiple filter.
Cant we use multiple filter like this
statement.setFilters(Filter.equal(“type”, “gal”),Filter.equal(“refid”, "1));
We currently do not have concrete time-frame for delivering this. But implementing this natively is certainly on the roadmap.
Just wondering if the current streamUDF alternative can suffice for now? We’ve mostly found the additional bin filters are on an already smaller subset of data after first bin is indexed. Additional use cases always help us out in determining product priority. Feel free to also reach out privately
For our project we don’t have a need for multiple filter statement so no urgency from our side. However, I can imagine requirements where they need to build filters at run time.
Sorry for reopening the issue again but I would like to know if there is a more concrete time-frame for delivering this feature now.
I would really really benefit from this, let me explain my use case.
I’d like to do a String equals filter for a certain field and then do a range filter by Timestamp, so I can get every record related to that field. Doing a range filter from my records and then filtering them by name using a UDF is too expensive as there would be too many records to filter, and if I filter first by name then its really cumbersome to sort the records by Timestamp inside a UDF.
It is possible to structure the secondary index such that string equality is the first filter, and the second filter (currently can only be in UDF) will be on the timestamp. It is not required that the first filter be a range filter.
I use your approach,I would be filtering the first set of records using the Secondary Index in the query, but the remaining records will be filtered one by one by inside the UDF. However, you have to go through the whole set.
If you are able to use two Secondary Indexes in your filters you wouldn’t have to go through the first subset fully. Am I correct?
Also, I think it is very confusing to provide a method in Java allowing multiple filters to be passed when only one of them works. I started developing a solution using multiple filters only to find out in forums that they don’t work yet. If the method only accepted one filter and then later a new method for multiple filters is added, it would not be so confusing.
Thank you for your reply.
EDIT: In my previous comment I was also asking if you know about the time-frame for this function to be implemented. Is there any approximate date available for this?
If you are able to use two Secondary Indexes in your filters you
wouldn’t have to go through the first subset fully. Am I correct?
There are different strategies of supporting multiple filters, each with different cost and complexity. Doing a first level filtering using secondary Index to quickly filter out the majority data is simple and easy to understand, so this is where we started with.
Right now, we do not have a time-frame yet for the next steps.
Also, I think it is very confusing to provide a method in Java allowing
multiple filters to be passed when only one of them works. I started
developing a solution using multiple filters only to find out in forums
that they don’t work yet. If the method only accepted one filter and
then later a new method for multiple filters is added, it would not be
so confusing.
Fully agree. Will update Java Client documentation to make this more clear. Thanks!