Error for N1QL command : 5000 , time out

guys m new on N1ql , trying to fire query for creating primary key on bucket,
CREATE INDEX id_ix on ram(meta().id);
(ram is bucket name)

it is giving error as
5000 - GSI CreateIndex() - cause: Request timed out. Index server may still be processing this request. Please check the status after sometime or retry.

please help me out.

You can wait for some time, say 1 hour, and then issue:

SELECT name, state FROM system:indexes;

You want to see state = online for your index.

tried for it. but it is not working . again it is showing
No primary index on keyspace ‘ram’. Use CREATE PRIMARY INDEX to create one

is there any other method to create primary key for a bucket??

Yes, you can create the index with deferred build, and then issue a BUILD command afterwards. This is in the documentation. Please consult the docs and try that, and then let us know.

i have tried in several ways to assign the key for the bucket. bt it is showing continuously error as CREATE PRIMARY INDEX ON beer-sample USING GSI…
i have tried from console as well as cbq command line …still it is giving error like that only

also tried several queries for creating or building primary key…

one more doubt … is this possible to fire other queries(like select) on bucket without giving primary key to that bucket???

Yes. You can query using USE KEYS, or using a secondary index.

I had a problem like this when I built a small dev server, and was addressing it using only its IP address. Got some very long response times. When I created a name for the server, entered the name (and IP) in my etc/hosts file, the server response time was much faster.

I ran

Select * From default Where Tag And Tag=="BankUserAccountInfo" USE KEYS;

but i got

“code”: 3000,
“msg”: “syntax error - at USE”,
“query_from_user”: “Select * From ShomaraDB Where Tag And Tag==“BankUserAccountInfo” USE KEYS;”

Please consult the documentation.

could you please let me know, which and where ?


The use keys clause section has an example here.

Link to N1QL reference docs :

You can also take a look at the following blog.



many thanks for your guidance