How to create secondary index on multiple fields (composite key)

we want to create a secondary index on 3 fields in a set. The goal is to query the data using these 3 fields. We are using Spring Data Aerospike. Please suggest appropriate solution.

In Aerospike, a secondary index is built on a single field, but you can separately create a secondary index on multiple fields. A query requires and uses a secondary index only on the field of the query predicate. Multiple secondary indexes in the namespace can be useful if you query the records separately using different queries, each using its own secondary index. If your filter has multiple fields, use the most selective (ie, that returns fewest records) portion of the predicate as the query predicate, and specify the remaining portion as a filter expression in the policy. (Hope this helps as I am assuming these abstractions are accessible through Spring Data Aerospike,)

Thank you Neel. This helps. Yes, we are using Spring Data Aerospike. And apologies for delayed reply (I was on vacation).

Jitendra

Neel,

It appears that filter expressions is supported in Spring Data Aerospike v3.2.0, released 20 days ago. I don’t find example on how to use it. Will be great if there is some documentation/example around using filter expressions with Spring Data Aerospike.

Thanks Jitendra

You can find a tutorial with examples and pointers to other content on Filter Expressions on the Developer Hub here.

© 2021 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.