Need ONE EXAMPLE of filterExp Using Aerospike Rest Gateway 2.0.2

Hello, Im using aerospike rest gateway 2.0.2. I want to filter on a bin during the scanAll process. For that Im looking to set filterExp. It expects a string. I have seen JAVA examples directly but not for rest gateway. My project is in PHP. I assume I need to write some expressions and base64 encode it. But how to write those expressions with rest gateway ?

A case we can consider: Write a expression for : getting all the data of set S where bin B is greater than X and less than Y.

Thanks a lot :pray:

There are examples in other languages as well on the developer hub. Did you check the filter expressions section and would examples in some of the other languages help? (I am not much familiar with the REST Gateway). You would then use such filter expression on the back of a primary index query (scan).

You may also consider using a secondary index on bin B, assuming it is an integer for which you can simply do a range query. There is an example in the REST Gateway documentation:

QueryRangeFilter{
description:	
Filter values numeric values within a range. Only allowed on bin which has a secondary index defined.

binName*	string
The bin for which a secondary-index is defined.

ctx	[...]
type*	string
begin*	integer($int64)
Filter begin value inclusive.

end*	integer($int64)
Filter end value inclusive.

collectionType	string
Enum:
Array [ 4 ]
oneOf ->	
QueryEqualsStringFilter{...}
QueryEqualLongFilter{...}
{...}
QueryContainsStringFilter{...}
QueryContainsLongFilter{...}
QueryGeoWithinPolygonFilter{...}
QueryGeoWithinRadiusFilter{...}
QueryGeoContainsPointFilter{...}
}

I was also trying to figure this out recently and found this doc for using expressions in the Aerospike Rest Gateway: https://github.com/aerospike/aerospike-rest-gateway/blob/master/docs/expressions.md.

Basically there are two ways:

  1. Using base64 encoded value of DSL
  2. Generating base64 encoded form of expression object using client libraries and using it