How can I query data from a record bins if they are not indexed

I am new to Aerospike and understands that we can create primary index and secondary indexes on the record bins. What is we want to query some data from the bins if they are not indexed. Do I need to scan the records each time or can I use query filters for it.

Please suggest.

Depends what you mean by “query”.

You can read an individual record and ask data from specific bin or bins only, to be returned.

You can scan all the records and ask for data from records that match a certain criteria on particular bin or bins value - see Predicate Filtering.

You can build a secondary index on a bin and do a range or equality filter for numeric values or equality filter for string value. See Secondary Indexes.