Getting error for BatchGet and FilterExpression

Hello. I am trying to use BatchGet operation with filter expression. And if at least one bin of the set does not match the conditions, I get error ““ResultCode: FILTERED_OUT, Iteration: 0, InDoubt: false, Node: : Transaction filtered out”” The same conditions of filter work fine when used in a Query.

This is my go-code:

var policy = as.NewBatchPolicy()

policy.FilterExpression = as.ExpGreater( as.ExpListGetByValue( as.ListReturnTypeCount, as.ExpStringVal(location), as.ExpListBin(“allowed”), ), as.ExpIntVal(1), )

recs, err := client.BatchGet(policy, keys)

If a key in the list you provide does not match the criteria, that key will be filtered out and the returned value will be nil. The error lets you know what happened.

Look, for example I have a set with 2 rows:

id       some_bin
1             1
2             2

And the condition

policy.FilterExpression = as.ExpGreater(as.ExpIntBin(“some_bin”), as.ExpIntVal(1))

will return error for client.BatchGet(policy, keys)

var keys []*as.Key
ids := int{1,2}
for _, id := range ids {
	key, _ := as.NewKey(Namespace, Set, id)
	keys = append(keys, key)
}
var policy = as.NewBatchPolicy()
recs, err := client.BatchGet(policy, keys)

and will return 1 row with some_bin=2 for client.Query(qpolicy, stmt)

That’s what is supposed to happen. You get some keys back where the expression applied, and you get an error that tells you the reason some others were not was that the condition didn’t match. What did you expect to get?

I expect to return rows for the specified ids that match the condition. In the previous example, this is a line with id = 2 But instead I get FILTERED_OUT error

© 2021 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.