How to get record by hash digest?

I want to read record like

Record record = client.get(policy, HASH, “name”, “age”);

instead of

Record record = client.get(policy, key, “name”, “age”);

Is it possible? Thank you in advance

You need three things to locate a record in Aerospike - namespace, set name (if used, can be null) and your key (that you used initially - say a string or integer). The “Key” object you pass to the get call comprises these three entities. The client library will compute the hash using set + your key, then in addition use the namespace to get the record. Aerospike only stores the hash (unless sendKey is set to true) but you need the namespace as well. So in your case, you can create the Key object that is passed to get() by specifying a namespace and hash and then pass that key object to get() but you cannot use get() with just the hash and not specifying a namespace.

1 Like