Aerospike secondary index query error

I can’t understand as to why this error is occuring. Here’s my simple code:

from __future__ import print_function
import aerospike
from aerospike import predicates as p

def print_result((key, metadata, record)):
    print(key, metadata, record)

config = {
    'hosts': [
        ( '127.0.0.1', 3000 )
    ],
    'policies': {
        'timeout': 1000
    }
}

try:
	client = aerospike.client(config).connect()
except ClientError as e:
	print("Error: {0} [{1}]".format(e.msg, e.code))
	sys.exit(1)

client.put(('test', 'test', 1), {
    'timestamp': 123456789,
    'data' : [1, 2, 3, 4, 5]
    })

client.put(('test', 'test', 2), {
	'timestamp': 123456788,
	'data' : [11, 12, 13, 14, 15]
    })

query = client.query('test', 'test')
query.select('timestamp', 'data')
query.where( p.equals('timestamp', 123456789) )
records = query.results()
pp.pprint(records)

client.close()

this returns: Traceback (most recent call last): File “testquery.py”, line 36, in records = query.results() exception.IndexNotFound: (201L, ‘AEROSPIKE_ERR_INDEX_NOT_FOUND’, ‘src/main/aerospike/aerospike_query.c’, 335)

Okay, but do you actually have a secondary index built on integer values in the ‘timestamp’ bin of test.test? It’s required for you to do a query.

Hey thank you for a prompt reply. It seems I had wrongly named timestamp as timespace.

aql> show indexes
+--------+-------------+-----------+--------+-------+-----------+-------------+------------+-----------+
| ns     | bin         | indextype | set    | state | indexname | path        | sync_state | type      |
+--------+-------------+-----------+--------+-------+-----------+-------------+------------+-----------+
| "test" | "timespace" | "NONE"    | "test" | "RW"  | "ix1"     | "timespace" | "synced"   | "NUMERIC" |
+--------+-------------+-----------+--------+-------+-----------+-------------+------------+-----------+
1 row in set (0.001 secs)
OK