Tarun
Tarun

Reputation: 3165

Aerospike: Read records from a particular node using secondary index

I want to read records from Aerospike DB using Secondary index.
Could you please if its possible to read records using secondary index from a particular node ( rather than from all nodes --- Default Behavior )

I am looking to do this operation in Java. Could you please point appropriate document or source code for the same.

Upvotes: 0

Views: 201

Answers (1)

pgupta
pgupta

Reputation: 5415

Aerospike distributes all your records evenly across all nodes of your cluster. Lets say you have a 3 node cluster with 6 records as below and possible distribution by nodes shown for argument:

id - age - name  (On node)
1 - 30 - Jack ( on n1)
2 - 34 - Jill (on n3)
3 - 31 - Bill  (on n1)
4 - 29 - Jane  (on n2)
5 - 40 - Tim  (on n3)
6 - 20  - Nik  (on n2)

and you build a secondary index on age - and ask for all records where age between 28 and 32 -- the secondary index query will be sent to each node, and each node will send the records that match back to client. So, you can't issue a SI query and say find me all records where age is between 28 and 32 just on node n1. No can do - no such feature in Aerospike.

Upvotes: 4

Related Questions