Multiple range filters

I’m trying to do a range filter on multiple secondary indexes (the bins are ‘p’ and ‘ts’). It looks like my only option is a Stream UDF. So, I created the following UDF:

function apply_partition_filter(s, beginPartition, endPartition)
    local myfilter = partition_filter(beginPartition, endPartition)
    return s : filter(myfilter)
end


local function partition_filter(beginPartition, endPartition)
    return record['p'] >= beginPartition and record['p'] <= endPartition
end

I tried executing this (after registering the UDF) aql> execute ns.apply_partition_filter(0,1) on ns.set where ts between 0 and 1 and received the following error: Error: “Execute” supports a complete namespace scan or a primary-key operation. Type help for syntax.

So, I tried the aggregate function: aql> aggregate ns.apply_partition_filter(0,1) on ns.set where ts between 0 and 1 and received the error Error: (500) AEROSPIKE_ERR_SERVER : “UDF: Execution Error 1”

Any suggestions on what I might be doing wrong here?

Here is an example for doing query filtering: http://www.aerospike.com/community/labs/query_multiple_filters.html

Please create a map() stage to translate the appropriate bin values into a none “record” data structure (such as map or list) for returning back to client. Without it, a “record” type is attempted to be returned to the client. Currently it is not possible to return a “record” type to client.

We are also looking at improving the error response to make this condition more obvious.

Thanks.