Skip to content

Index not found when quering list index #977

@DKanarsky

Description

@DKanarsky

Hi! After creating a string list index, queries raise an IndexNotFound error:

client = aerospike.client(config).connect()

client.index_list_create(
    'cluster',
    'set',
    'bin',
    aerospike.INDEX_STRING,
    'list-index'
)

client.put(('cluster', 'set', 'record'), {'bin': ['a', 'b', 'c']})

q = client.query('cluster', 'set')
q.where(
    aerospike.predicates.contains('bin', aerospike.INDEX_STRING, 'a')
)
q.results()

This results in:

---------------------------------------------------------------------------
---------------------------------------------------------------------------
IndexNotFound                             Traceback (most recent call last)
Cell In[12], line 5
      1 q = client.query('cluster', 'set')
      2 q.where(
      3     aerospike.predicates.contains('bin', aerospike.INDEX_STRING, 'a')
      4 )
----> 5 q.results()

IndexNotFound: (201, 'AEROSPIKE_ERR_INDEX_NOT_FOUND\nsub-errors:\n201,1,127.0.0.1:3100,AEROSPIKE_ERR_INDEX_NOT_FOUND\n201,2,127.0.0.1:3100,AEROSPIKE_ERR_INDEX_NOT_FOUND\n201,3,127.0.0.1:3100,AEROSPIKE_ERR_INDEX_NOT_FOUND\n201,4,127.0.0.1:3100,AEROSPIKE_ERR_INDEX_NOT_FOUND\n201,5,127.0.0.1:3100,AEROSPIKE_ERR_INDEX_NOT_FOUND\n201,6,127.0.0.1:3100,AEROSPIKE_ERR_INDEX_NOT_FOUND', 'src/main/aerospike/as_partition_tracker.c', 541, False)

However, if I change the index type to aerospike.INDEX_NUMERIC, the query works as expected:

q = client.query('cluster', 'set')
q.where(
    aerospike.predicates.contains('bin', aerospike.INDEX_NUMERIC, 'a')
)
q.results()
[(('cluster',
   'set',
   'record',
   bytearray(b'\xfc\xfe\x86S\x1c\x14\xe7\xf0\xe3\xb9\x1dHTNz\x96!*~j')),
  {'ttl': 4294967295, 'gen': 1},
  {'bin': ['a', 'b', 'c']})]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions