Sathiya Narayanan
Sathiya Narayanan

Reputation: 641

How to add filter to match the value in a map bin Aerospike

I have a requirement where I have to find the record in an aerospike based on attributeId. The data in aerospike is inthe below format

{
 name=ABC, 
 id=xyz, 
 ts=1445879080423, 
 inference={2601=0.6}
}

Now I will be getting the value "2601" programatically and I should find this record based on this value. But the problem is the value is in a Map and the size of this map may be more than 1 like

inference={{2601=0.6},{2830=0.9},{2931=0.8}}

So how can I find this record using attributeId in java. Any suggestions much appreciated

Upvotes: 1

Views: 435

Answers (1)

Helipilot50
Helipilot50

Reputation: 227

A little know feature of Aerospike is that, in addition to a Bin, you can define an index on:

  • List values
  • Map Keys
  • Map Values

Using in index defined on your map keys in the "inference" bin, you will be able to query (filter) base on the key's name.

I hope this helps

Upvotes: 1

Related Questions