Sandhya
Sandhya

Reputation: 108

Error in Aerospike while accessing secondary index AEROSPIKE_ERR_INDEX_NOT_READABLE

Aerospike is throwing AEROSPIKE_ERR_INDEX_NOT_READABLE error when I try to access the secondary indexes. Created index using below syntax

CREATE INDEX index_id ON test.class (id) STRING;

Any suggestions would be greatly appreciated.

Upvotes: 1

Views: 653

Answers (2)

pgupta
pgupta

Reputation: 5415

aql> create index id1 on ns1.testset (1) string;
OK, 1 index added.

aql> show indexes
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| ns    | bin | indextype | set       | state | indexname | path | type     |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| "ns1" | "1" | "NONE"    | "testset" | "WO"  | "id1"     | "1"  | "STRING" |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
[127.0.0.1:3000] 1 row in set (0.001 secs)

+-------+-----+-----------+-----------+-------+-----------+------+----------+
| ns    | bin | indextype | set       | state | indexname | path | type     |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| "ns1" | "1" | "NONE"    | "testset" | "WO"  | "id1"     | "1"  | "STRING" |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
[172.14.10.12:3000] 1 row in set (0.002 secs)

OK

aql> show indexes
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| ns    | bin | indextype | set       | state | indexname | path | type     |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| "ns1" | "1" | "NONE"    | "testset" | "RW"  | "id1"     | "1"  | "STRING" |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
[127.0.0.1:3000] 1 row in set (0.001 secs)

+-------+-----+-----------+-----------+-------+-----------+------+----------+
| ns    | bin | indextype | set       | state | indexname | path | type     |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
| "ns1" | "1" | "NONE"    | "testset" | "RW"  | "id1"     | "1"  | "STRING" |
+-------+-----+-----------+-----------+-------+-----------+------+----------+
[172.14.10.12:3000] 1 row in set (0.002 secs)

OK

Note: 1) don't need the semicolon when creating index but it won't throw error. So:

aql> create index id1 on ns1.testset (1) string 

would be the right way. 2) Once you issue the command to create the index, depending on the data size, takes time to build the SI. Check state: WO --> Index is not readable yet but you can insert records and they will be indexed. When state becomes "RW" - read/write - you can do SI queries.
You shouldn't have to restart Aerospike server.

Upvotes: 3

Sandhya
Sandhya

Reputation: 108

After restarting Aerospike I am able to use the newly created index.

Upvotes: 1

Related Questions