How to get record PK (primary key) with aql

Hi, is it possible to see record PK?

select * from namespace does not return it.

Hi,

You can not get PK through aql.

If you want to get primary keys of record resulting of scan or query, first you need to write the records with sendKey true in write policy. Here is the link for java client - http://www.aerospike.com/apidocs/java/com/aerospike/client/policy/Policy.html#sendKey

Once you have done this you will be able to read primary key in record’s metadata in your application code.

Thanks

1 Like

pratyyy,

Got it, thanks!

I opened a feature request internally, TOOLS-551 and TOOLS-539. Keep an eye out for a mention of it in the release notes.