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?