Filter and logical operators: how many filters per query does Aerospike support?

stmt := as.NewStatement("asd", "asd")    
stmt.Addfilter(as.NewEqualFilter("Name", ""))
stmt.Addfilter(as.NewEqualFilter("Name", "string"))

This code will search Name = “” || “string” or Name = “” && “string”?
How search Bin Name which contain “” or “string”?
Thanks.

At the moment, only one filter is supported by Aerospike Server per query.

Only one Bid name or only one filter?

stmt.Addfilter(as.NewEqualFilter("Name1", "string1"))
stmt.Addfilter(as.NewEqualFilter("Name2", "string2"))

Not work?

No that won’t work.

Only a single filter is allowed through the driver, you have to use a UDF if you want to filter on more properties.

Maybe this should return an error or even panic client-side, when trying to add a second filter?

Also, documentation could be improved. AddFilter kind of implies that multiple filters can be added. Just opened a PR for that (Add warning about setting multiple filters per statement by GeertJohan · Pull Request #98 · aerospike/aerospike-client-go · GitHub).

1 Like