Client queries using multiple filters



I have created two secondary indexes (customer and orderID). It works well with single filter but when I try to chain two or more filters I run into the following bug:

{ code: 4,
  func: 'as_query_parse_records',
  file: 'src/main/aerospike/aerospike_query.c',
  line: 223 }

Here is the query that I’m trying to execute:

var aerospike = require('aerospike');

var statement = {};
statement.filters = [
  aerospike.filter.equal('customer', 'ABC Customer'),
  aerospike.filter.range('orderID', 604221, 604224)

var query = client.query('test', 'orders', statement);
var dataCallback = function(record) {
  // process the scanned record
var errorCallback = function(error) {
  // process the error
var endCallback = function() {
  //process the end of query results.
var stream = query.execute(); // returns a stream object.
stream.on('data', dataCallback);
stream.on('error', errorCallback);
stream.on('end', endCallback);

Is chaining filters supported by the NodeJS client API? Or am I doing something wrong?



Aerospike doesnt support multiple secondary index predicates in a single query call:

Features and Limitations

  • Aerospike supports up to 256 secondary indexes per namespace in the system.
  • Currently does not support “fast restart”.
  • Tuned for queries that use high selectivity secondary indexes.
  • The query predicates available in Aerospike include “EQUAL” for string and numeric indexes, and “RANGE” for numeric indexes. Currently only one predicate is supported.


This pretty much makes Aerospike a cache machine rather than a database. I would love the Aerospike team to comment on this…



It’s a key/value store so that’s what it works well for, actions on a primary key.

It’ll never be as flexible as a relational database with SQL but you can use Lua to create UDFs that do whatever filtering you need in Aerospike and I think the team is working on adding multiple filter ability in a later version.


Can you please share an example on how to use multi query filters using udf.


Please see How to use Aggregation? and Record manipulation with more than one filter - lua