Getting error when using equals() predicate on a query


#1

I’d like to get a query of records containing an exact match with a particular bin

I first do

query = client.query(‘test’, ‘raw_data’)

query.where(p.equals(‘processed’, 0))

and so far no errors. However, when i try to print the results using

query.foreach(print_result),

I get the following error

exception.IndexNotFound: (201L, ‘AEROSPIKE_ERR_INDEX_NOT_FOUND’, ‘src/main/aerospike/aerospike_query.c’, 228)

Does this mean I have to put an index on any bin which I might ever want to query for? if yes, how exactly, and if no, then what would be the way to achieve this?

thanks a lot :blush:


#2

Fixed the problem by adding index to the required bin.

command used:

CREATE INDEX numindex ON <namespace>.<set>(<bin>) NUMERIC


#3

You got it. Here’s some reference: