List Keys : List keys in a ns.set

The Aerospike Knowledge Base has moved to Content on is being migrated to either or Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via


We understand that in Aerospike, a “key” consists of a namespace,set,key. And using aql, we can show every records in a ns.set; however it does not show the key of each record. Is there a way to list the keys in a ns.set?


There is a way to list the keys in a ns.set, you can use AS_POLICY_KEY_SEND, If you want keys to be returned when scanning or querying, the keys must be stored on the server. This policy causes a write operation to store the key. Once a key is stored, the server will keep it – there is no need to use this policy on subsequent updates of the record.

More information can be found: