Have a strange error with the index query - the Ruby code snippet below -
stmt = Statement.new("marketcheck", "listings", ["id", "price", "miles", "scraped_at", "status_date", "is_searchable_is", "seller_name", "source", "group_id", "grouped_at", "zip", "is_grouped", "touch_count", "is_duplicate"])
stmt.filters << Filter.Equal("vin", vin)
rs = aerospike_client.query(stmt)
listings = []
rs.each do |rec|
puts rec
end
return listings
It returns an error as follows -
Aerospike::Exceptions::Aerospike: Index error
from /home/anand/.rvm/gems/ruby-2.1.5/gems/aerospike-1.0.11/lib/aerospike/query/stream_command.rb:47:in `parse_record_results'
from /home/anand/.rvm/gems/ruby-2.1.5/gems/aerospike-1.0.11/lib/aerospike/command/batch_command.rb:51:in `parse_result'
from /home/anand/.rvm/gems/ruby-2.1.5/gems/aerospike-1.0.11/lib/aerospike/command/command.rb:454:in `execute'
from /home/anand/.rvm/gems/ruby-2.1.5/gems/aerospike-1.0.11/lib/aerospike/client.rb:941:in `execute_command'
from /home/anand/.rvm/gems/ruby-2.1.5/gems/aerospike-1.0.11/lib/aerospike/client.rb:749:in `block (2 levels) in query'
The index was created from the Aerospike Monitoring console -
The same index queries using the Node client works okay. The code that works with the node driver -
app.get('/history/:vin', function (req, res) {
console.log('History for VIN - ' + req.params.vin);
var vin = req.params.vin;
var statement = {};
var filter = aerospike.filter;
statement.filters = [filter.equal("vin", vin)];
statement.select = ["id", "price", "miles", "scraped_at", "status_date", "is_searchable", "seller_name", "source", "group_id", "grouped_at", "zip", "is_grouped", "touch_count", "is_duplicate"];
var query = client.query('marketcheck', 'listings', statement);
var stream = query.execute();
var records = [];
stream.on('data', function(record){
records.push(record.bins);
});
stream.on('error', function(error) {
console.log("VIN Stream ERROR - " + vin);
res.json({'status': 2, 'message': error});
});
stream.on('end', function() {
console.log("VIN Stream end - " + vin + " Total records - " + records.length);
records.sort(function(a,b){return parseInt(b.status_date) - parseInt(a.status_date)});
res.json({'status': 1, 'data': records})
});
});