# How to create and use sindex in aql for mapbins

**URL:** <https://discuss.aerospike.com/t/how-to-create-and-use-sindex-in-aql-for-mapbins/11057>\
**Category:** AQL\
**Created:** [May 3, 2024, 1:54pm UTC](https://discuss.aerospike.com/t/how-to-create-and-use-sindex-in-aql-for-mapbins/11057 "2024-05-03T13:54:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PKuchibhatla](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pkuchibhatla/32/2284_2.png) [@PKuchibhatla](https://discuss.aerospike.com/u/PKuchibhatla)\
**Post date:** [May 3, 2024, 1:54pm UTC](https://discuss.aerospike.com/t/how-to-create-and-use-sindex-in-aql-for-mapbins/11057/1 "2024-05-03T13:54:06Z")

</div>

Can any one help me out with the sindex for map bin in a set . how to set index on a specific key

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [May 3, 2024, 5:01pm UTC](https://discuss.aerospike.com/t/how-to-create-and-use-sindex-in-aql-for-mapbins/11057/2 "2024-05-03T17:01:25Z")

</div>

Creating the sindex - I will discuss two ways: One via the Java client, other via asadm tool. First Java client version:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/aerospike/original/2X/c/c41b85896ae0f90fdcf2354dc4b123a93b9db463.png)

Here, I want to do string equality on the value associated with a nested map key:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/aerospike/original/2X/8/8a0c1a02302178b62f872ac4fe23a25d46ee1548.png)

The execution helper function is:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/aerospike/original/2X/7/76d7faf17fc36b0ceba4321126bf42411e5590d1.png)

If you are looking to index the MAP KEY ( and search for the key, not the value associated with it), here is an example:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/aerospike/original/2X/6/6d349f867182074ff3e3568d0d8ed1db424d9bd2.png)

Same case, but Keys in integer range …

 ![image](https://us1.discourse-cdn.com/flex019/uploads/aerospike/original/2X/6/6728611da30d3513a159b50ee46c2baa4a57b46a.png)

You can also create SIs on CDTs with asadm tool also - command syntax with a CDT example is listed here: [Aerospike Admin Live Cluster Mode Commands | Aerospike Documentation](https://aerospike.com/docs/tools/asadm/live_cluster_mode_guide#secondary-indexes-1)

Hope that helps!
