Select set of bins

I’m using aerospike comunity server 3.3.8 and java client 3.0.26.

I insert a set of record like this:

client.put(writePolicy, new Key(NAMESPACE, SET, “bin1”), new Bin(“bin_name1”, “bin_value1_r1”), new Bin(“bin_name2”, “bin_value2_r1”),new Bin(“bin_name3”, “bin_value3_r1”),new Bin(“bin_name4”, 1));

and I want to recover only the bins: bin_name1, bin_name2 and bin_name3.

My program is like this //insert records //create index … Statement statement = new Statement();

statement.setNamespace(NAMESPACE); statement.setSetName(SET); statement.setBinNames(“bin_name1”, “bin_name2”, “bin_name3”);

// statement.setFilters(Filter.range(“bin_name4”,0,10)); <----- COMMENT

RecordSet rS= client.query(queryPolicy,statement); while (rS.next()){ Record record = rS.getRecord();

} … In this case I return the four bins in the record but if I uncomment the line // statement.setFilters(Filter.range(“bin_name4”,0,10)); the record return me only the three bins. In Theory the filter is optional but I can’t recover the expected result without use it.

Somebody can help me.

Thanks.

When a filter is applied, only the requested bin names are returned. When a filter is not applied, all bin names are returned regardless of what bin names are requested.

The reason is the server converts the query to a scan when a filter is not applied. Scans do not currently allow specific bins to be requested. Hopefully, this will change in a future release.