Lakshya Bansal
Lakshya Bansal

Reputation: 113

Querying a primary key through java client - Aerospike

I'm trying to emulate the query Select * from namespace.set where pk="something" through aeropsike's java client. I know that we can query on a secondary index through "Filter", and create "PredExp" for other predicates, but I'm unable to figure out how we can query on a primary key. Any help would be appreciated. Thanks a lot in advance.

Edit : I have multiple bins in my set, if that makes any difference.

Upvotes: 2

Views: 566

Answers (1)

Lakshya Bansal
Lakshya Bansal

Reputation: 113

I figured it out. You just have to create a "new key" while querying through the java aerospike client.

Record record = aerospikeClient.get(null, new Key(namespace, cacheName, key), binNames)

Refer to the discussion: https://discuss.aerospike.com/t/primary-key-search/558/6

Upvotes: 2

Related Questions