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

**URL:** https://discuss.aerospike.com/t/how-can-i-query-data-from-a-record-bins-if-they-are-not-indexed/5176
**Category:** General Discussion
**Created:** [May 11, 2018, 7:16am UTC](https://discuss.aerospike.com/t/how-can-i-query-data-from-a-record-bins-if-they-are-not-indexed/5176 "2018-05-11T07:16:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rajan471](https://avatars.discourse-cdn.com/v4/letter/r/edb3f5/32.png) [@rajan471](https://discuss.aerospike.com/u/rajan471)
#### Post date: [May 11, 2018, 7:16am UTC](https://discuss.aerospike.com/t/how-can-i-query-data-from-a-record-bins-if-they-are-not-indexed/5176/1 "2018-05-11T07:16:33Z")

</div>

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.

---

<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 11, 2018, 4:47pm UTC](https://discuss.aerospike.com/t/how-can-i-query-data-from-a-record-bins-if-they-are-not-indexed/5176/2 "2018-05-11T16:47:14Z")

</div>

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](https://www.aerospike.com/docs/guide/predicate.html).

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](https://www.aerospike.com/docs/architecture/secondary-index.html).
