AEROSPIKE_ERR_INDEX_NOT_FOUND issue

Hi,

I’m facing this error while trying to retrieve record based on a secondary index. Here’s my query

select * from caas.content where topic_id='GUID-E8E101ED-A9BC-46E8-A89F-8F1327B1AA44'
0 rows in set (0.001 secs)
Error: (201) AEROSPIKE_ERR_INDEX_NOT_FOUND

I’ve a secondary index on the field topic_id. Not sure what’s the issue is. I dropped and recreated the index, but didn’t make any difference. Here’s my index view

Not sure what’s wrong. I’ve another secondary index on node_id, it’s working fine.

Any pointers will be appreciate.

Based on your screen capture, the “num_bins” is not 1. Are you using AMC to create the index or was through code/client? I did it (create 2 indexes over the same set) thru AMC and I didn’t have any problems

I didn’t use AMC, rather aql console to create the index. This is also one my doubts as in why the “bin” column doesn’t show up for one of the nodes.

Could you provide the contents of

 /opt/aerospike/smd/sindex_module.smd

from all nodes?

Here’s the content

[
   {
      "module": "sindex_module",
      "key": "caas:topicIdx",
      "value": "ns=caas;set=caascontent;indexname=topicIdx;numbins=1;indexdata=topic_id,STRING;priority=normal",
      "generation": 1,
      "timestamp": 10166244989
   },
  
 {
      "module": "sindex_module",
      "key": "caas:nodeIdx",
      "value": "ns=caas;set=caascontent;indexname=nodeIdx;numbins=1;indexdata=node_id,STRING;priority=normal",
      "generation": 1,
      "timestamp": 10181645286
   }
]

I take it the contents were the same on all nodes?

How many records are currently loaded in the cluster that these indices should apply to?

The indices probably apply to around 8 million documents. I once again dropped the index from the node (missing bin entry), restarted it, after a while it seemed to have started on its own. Not sure if it’s fixed for all topic ids or few of them. There’s no easy way for me to know right row. But, I’m curious to know what might be the probable cause? Is it recommended to create an index before populating the document ? Can creating a new index on an existing document lead to a problem like this?

Had another pair of eyes review this:

The problem here is your query is going against caas.content (namespace = caas, set = content).

Your secondary index is defined as caas.caascontent (namespace = caas, set = caascontent). So your query really is against a non-existent secondary index.