Unable to get a record by filter 'contains' if bin array includes > 1 element

Hello! I encountered an unusual issue. I’m not sure if it’s a bug or if I’m mistaken, but I would appreciate some clarification :slight_smile: So the summary is: while trying to search across the indexed array bin, If the array includes 1 element, function contains works well. But if the array has more than 1 element, contains doesn’t recognize that this record should be returned.

Here is code to reproduce and its result:

const Aerospike = require('aerospike');
const client = Aerospike.client({

async function connect () {
  await client.connect();
  var index = {
    ns: 'test',
    set: 'demo',
    bin: 'tags',
    index: 'tags_idx',
    type: Aerospike.indexType.LIST,
    datatype: Aerospike.indexDataType.STRING
  await client.createIndex(index)
  const key1 = new Aerospike.Key('test', 'demo', 'key1');
  const key2 = new Aerospike.Key('test', 'demo', 'key2');
  const key3 = new Aerospike.Key('test', 'demo', 'key3');

  const record1 = {
    key: 'key1',
    tags: ['tag1'],
    data: 'wow'

  const record2 = {
    key: 'key2',
    tags: ['tag2'],
    data: 'wow2'

  const record3 = {
    key: 'key3',
    tags: ['tag1, tag2'],
    data: 'wow3'

  await client.put(key1, record1);
  await client.put(key2, record2);
  await client.put(key3, record3);

  const query = client.query('test', 'demo');
  query.where(Aerospike.filter.contains('tags', 'tag1', Aerospike.indexType.LIST))
  const queryStream = await query.results();
  console.log(queryStream.map(res => console.log(res.bins)))

EXPECTED: an array of 2 records with key1 and key3 CURRENT: only one element with key1. Record with key 3, that includes 2 els, does not recognized.

I’m not sure why this is happening. Can you help me with this, please?