Query on List (Complex Data Types)

query
udf

#1

I have a bin which contains a list: [1,2,3], then I created an NUMERIC index on the bin. For some reason I cannot query it.

Does the query support it? Thanks


#2

After some digging, feel like this can be accomplished by using UDF. I’m hoping there are some simple/elegant query capabilities. This really slows down the dev effort if lacking better query capabilities, comparing with MongoDB.

Any suggestions?


#3

A numeric index ignores any value in that bin whose data type is not an integer. You have a list which will be ignored. What you need to do is build an index for the type list, for list elements of a numeric data type.

In the Python client you’d use aerospike.Client.index_list_create and set the index_datatype to aerospike.INDEX_NUMERIC. Other language clients have similar methods. The warning you see in the client has to do with performance. It is currently tagged as an experimental feature because it’s not as performant as a secondary index built over bins with integer or string data types. Still, it’s something that is in progress, and it may perform well enough for your needs. A future release of the server will announce secondary indexes over lists, map keys and map values as mature.

In general, different databases have different strengths. MongoDB is loaded with many features, while Aerospike adds features that perform very well at scale. Usually Aerospike is selected for its strength in performance and ease of vertical and horizontal scaling compared to other databases. It all depends on your requirements.


#4

Ronen, Thanks for your response.