Not getting PK when making a query using Secondary Index

I am not able to get Key when making a query using Secondary Index

aql> show indexes;
+--------+------+-----------+-----------------------+-------+-----------+------+-----------+
| ns     | bin  | indextype | set                   | state | indexname | path | type      |
+--------+------+-----------+-----------------------+-------+-----------+------+-----------+
| "test" | "rs" | "NONE"    | "new_customers_table" | "RW"  | "index1"  | "rs" | "NUMERIC" |
+--------+------+-----------+-----------------------+-------+-----------+------+-----------+

aql> SELECT PK, rs from test.new_customers_table where rs between 200 and 210;'
+-----+-----+
| PK  | rs  |
+-----+-----+
|     | 201 |
|     | 201 |
|     | 201 |
+-----+-----+
3 rows in set (0.002 secs)

OK

aql> SELECT PK, rs from test.new_customers_table where PK='abcd'
+-------------+-----+
| PK          | rs  |
+-------------+-----+
| "abcd"      | 201 |
+-------------+-----+
1 row in set (0.001 secs)

Have you tried doing it from code? AQL is just a simple tool

Yes, I am getting same issue there: How to get Key from Query Records

it might not be possible, so i’d defer to one of the employees checking the threads but you could easily workaround by saving the PK in a bin instead of saving the pk

Its solved using SendKey

1 Like
© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.