#primary index already exists, but 'not online'


I’m evaluating N1Ql to possibly replace our map/reduce. Using cbq for testing.

When I try to create a primary key on our bucket:


I get the error:

“code”: 5000,
“msg”: “GSI CreatePrimaryIndex() - cause: Index #primary already exist.”

but when I run a query with:

select * from master limit 1;

I get:

“code”: 4000,
“msg”: “Primary index #primary not online.”

On the server console, the #primary index “Initial Build Progress” is at 0%.

Am I missing something?



Hi @prasad, @deepkaran.salooja, any suggestions?

hi @james, can you check the indexer log for any errors/warnings. Can you verify indexer process is up & running, and are you able to run other queries with secondary indexes?

Try restarting Couchbase services, and drop/recreate the primary index.
Btw, what is the couchbase version & OS/platform?


@james, as the “Initial Build Progress” is at 0%, query will not be able to use the index. Can you check if all the ports mentioned here for index service are accessible:

Thanks for the help…

Couchbase version is 4.1. OS is ubuntu.

The only error I see in the logs is

Service ‘goxdcr’ exited with status 1. Restarting. Messages: MetadataService 2016-10-06T19:16:48.712Z [ERROR] metakv.ListAllChildren failed.

I checked the ports: 9100 to 9105 and they’re all open.

I’ll try a restart…

Just a late update that restarting the server got the indexes to rebuild and everything works now.

Thanks for the help.

1 Like