aerospike - Unable to use stream UDFs on MAPKEYS index -


i have bin map datatype , created secondary on mapkeys. want run udf filter on mapkeys index. gives error aerospike_err_index_not_found.

this aql query:
aql> aggregate test.check_password('hii') on test.user in mapkeys pids = 'test2' error: (201) aerospike_err_index_not_found

whereas normal query works
aql> select * test.user in mapkeys pids = 'test2'
returns data

sample data inserted testing, in ideal case map of string object

enter image description here

aql> insert test.user (pk, pids, test2, test1) values ('k1',  map('{"test1": "t1", "test2": "t2", "test3":"t3", "test4":"t4", "test5":"t5"}'), "t2bin", "t1bin") aql> insert test.user (pk, pids, test2, test1) values ('k2',  map('{"test1": "t1", "test3":"t3", "test4":"t4", "test5":"t5"}'), "t2b", "t1b") aql> insert test.user (pk, pids, test2, test1) values ('k3',  map('{"test1": "t1", "test2":"t22", "test4":"t4", "test5":"t5"}'), "t2b", "t1b")  aql> create mapkeys index pidindex on test.user (pids) string ok, 1 index added.  aql> select * test.user in mapkeys pids="test2" +--------------------------------------------------------------------------------+---------+---------+ | pids                                                                           | test2   | test1   | +--------------------------------------------------------------------------------+---------+---------+ | map('{"test2":"t22", "test4":"t4", "test5":"t5", "test1":"t1"}')               | "t2b"   | "t1b"   | | map('{"test2":"t2", "test3":"t3", "test4":"t4", "test5":"t5", "test1":"t1"}')  | "t2bin" | "t1bin" | +--------------------------------------------------------------------------------+---------+---------+ 

i inserted 3 records in format, 1 did not have test2 key in map (k2). created secondary index on mapkey , ran query, gave me desired result.

aggregate used run stream user defined function on result set of records. udf code want run?

(aggregate test.check_password("hii") ....implies have test.lua file has check_password() function takes string argument. )

you must create secondary index on map keys first. reporting index not found. check if have index, can do:

aql> show indexes +--------+--------+-----------+--------+-------+------------+--------+------------+----------+ | ns     | bin    | indextype | set    | state | indexname  | path   | sync_state | type     | +--------+--------+-----------+--------+-------+------------+--------+------------+----------+ | "test" | "pids" | "mapkeys" | "user" | "rw"  | "pidindex" | "pids" | "synced"   | "string" | +--------+--------+-----------+--------+-------+------------+--------+------------+----------+ 1 row in set (0.000 secs) ok 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -