in aql, I can type show indexes to get all secondary indexes. is there a way for python client as well?
Alright, let’s assume a new numeric index is created over the namespace test, set demo and bin age:
aql> CREATE INDEX demo_age_idx ON test.demo(age) NUMERIC
OK, 1 index added.
aql> show indexes
+--------+-------+-----------+--------+-------+----------------+-------+------------+-----------+
| ns | bin | indextype | set | state | indexname | path | sync_state | type |
+--------+-------+-----------+--------+-------+----------------+-------+------------+-----------+
| "test" | "age" | "NONE" | "demo" | "RW" | "demo_age_idx" | "age" | "synced" | "NUMERIC" |
+--------+-------+-----------+--------+-------+----------------+-------+------------+-----------+
1 row in set (0.001 secs)
OK
The Python client’s Client.info
method can be used to issue the info command sindex
:
from __future__ import print_function
import aerospike
config = {'hosts': [('33.33.33.91', 3000)] }
client = aerospike.client(config).connect()
response = client.info('sindex/test')
print(response)
client.close()
Which returns a dict
containing a string that you’ll need to parse:
{'BB977293B290C00': (None, 'ns=test:set=demo:indexname=demo_age_idx:bin=age:type=NUMERIC:indextype=NONE:path=age:sync_state=synced:state=RW;\n')}
Thank you @rbotzer for a detailed answer. That surely worked. Can we expect parsed data in future releases?