# Query on List (Complex Data Types)

**URL:** <https://discuss.aerospike.com/t/query-on-list-complex-data-types/2315>\
**Category:** General Discussion\
**Tags:** query, udf\
**Created:** [December 29, 2015, 3:51am UTC](https://discuss.aerospike.com/t/query-on-list-complex-data-types/2315 "2015-12-29T03:51:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fei\_Yao](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@Fei\_Yao](https://discuss.aerospike.com/u/Fei_Yao)\
**Post date:** [December 29, 2015, 3:51am UTC](https://discuss.aerospike.com/t/query-on-list-complex-data-types/2315/1 "2015-12-29T03:51:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Fei\_Yao](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@Fei\_Yao](https://discuss.aerospike.com/u/Fei_Yao)\
**Post date:** [December 29, 2015, 4:56am UTC](https://discuss.aerospike.com/t/query-on-list-complex-data-types/2315/2 "2015-12-29T04:56:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rbotzer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/rbotzer/32/2114_2.png) [@rbotzer](https://discuss.aerospike.com/u/rbotzer)\
**Post date:** [December 29, 2015, 5:46am UTC](https://discuss.aerospike.com/t/query-on-list-complex-data-types/2315/3 "2015-12-29T05:46:24Z")

</div>

A numeric index ignores any value in that bin whose [data type](http://www.aerospike.com/docs/guide/data-types.html) 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`](http://www.aerospike.com/apidocs/python/client.html#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.

---

<div class="post-metadata">

**Author:** ![Fei\_Yao](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@Fei\_Yao](https://discuss.aerospike.com/u/Fei_Yao)\
**Post date:** [December 29, 2015, 1:42pm UTC](https://discuss.aerospike.com/t/query-on-list-complex-data-types/2315/4 "2015-12-29T13:42:00Z")

</div>

Ronen, Thanks for your response.
