2

I am inserting LargeMap(LDT) through java client into aerospike .

the problem here is I can't retrieve LDT from secondary index(Correct me if there is an option through java client) so I am planning to get 'PK'from secondary index which will solve my use case.

Though i can create a bin which holds "PK" values I don't want to create that for some reasons. So please Suggest me the way to do it

Thanks in advance.

E V S S Harsha
  • 91
  • 1
  • 1
  • 4

2 Answers2

4

Use following parameter to store key in record.

writePolicy.sendKey = true;

Query using secondary index and use following to get key of record.

Key key = record.getKey();

If you already inserted records without setting 'sendkey' parameter then you can't retrieve your PK.

3

You might find a similar response here at stackoverflow :

Aerospike: how do I get record key?

Also refer this aerospike documentation : https://www.aerospike.com/docs/client/java/usage/best_practices.html

Community
  • 1
  • 1
holmes840
  • 1,063
  • 2
  • 11
  • 24