Querying data based on MAPKEYS index and applying filters in UDF

stream
secondary
udf
map

#1

Our datastructure is in the following format. Each Record has two bins, one has a map and other one has string value. We created index on MAPKEYS, and trying to query the data using an UDF in the following format:

aql> aggregate test.check_password(‘hii’) on test.user in MAPKEYS where pids = 'test2’ Error: (201) AEROSPIKE_ERR_INDEX_NOT_FOUND

whereas the normal query works aql> select * from test.user in MAPKEYS where pids = 'test2’ returns some data

UDF with index on other bin also works.

Please let me know how to apply filter on the data queried on MAPKEYS index. Also is there any way we can limit the data in UDF (server side)


#2

Also discussed here: https://stackoverflow.com/questions/45780560/unable-to-use-stream-udfs-on-mapkeys-index Please share sample record. Your AQL query construct looks incorrect.


#3

updated the record


#4

This might be a bug in AQL or a missing bit of functionality. What I’m curious about is how you’re using AQL. It’s a tool for inspecting your data, managing indexes, managing UDFs, and applying UDFs to the records in a specific set or that match a query. It’s also good for debugging your Lua, which may be your purpose.

If you’re trying to do things programmatically it would be best to write your code in Python, Java, or any other programming language that has an Aerospike client.


#5

yes. Querying via java client worked. Thanks.

Is there any way to put limit on server side in UDF itself?


#6

Check out the PredExp class examples for the Java implementation of predicate filtering.

You mean the equivalent of LIMIT in SQL?


#7

See reply on stackoverflo