Create indexing problem on N1QL


#1

Hi,
Im not able to create indexing, im using following statement for creating index.

CREATE INDEX list_stores_index ON default(documentType ,accountNumber,storeNumber,storeAccountNumber,channels,createdDate,updatedDate, META(d).id , _sync.history.revs[0])

I’m getting error like "code": 1000, “msg”: “The server or request is read-only and cannot accept this write statement.”

Following the select statement for fetch the matched documents by using Indexing.

select documentType ,accountNumber,storeNumber,storeAccountNumber,channels,createdDate,updatedDate, META(d).id , _sync.history.revs[0] as _rev from default d USE INDEX ('list_stores_index') where accountNumber = '123451' AND documentType = 'StoreModel' _sync IS NOT MISSING

Can any one please help me on fix this issue?


#2

As the message said, your server or request is read-only. Did you install and start Couchbase Server yourself? If not, you need to contact the admin of your Couchbase instance, or create a new instance.


#3

@geraldss I was installed couchbase and its working because my http://myserver.com:8091/index.html working and im able login and seeing data there.


#4

Can you issue your CREATE INDEX statement using the cbq shell.


#5

Yay now it working, its problem of My request type. i change to post from get.

POST : CREATE INDEX list_stores_index ON default(documentType ,accountNumber,storeNumber,storeAccountNumber,channels,createdDate,updatedDate, META(d).id , _sync.history.revs[0])

GET: select documentType ,accountNumber,storeNumber,storeAccountNumber,channels,createdDate,updatedDate, META(d).id , _sync.history.revs[0] as _rev from default d USE INDEX ('list_stores_index') where accountNumber = '123451' AND documentType = 'StoreModel'

So am i doing right for getting indexing for get data quickly.

How can i get data from 1-10, 10-20… 100 records like pagination. have any technique to achieve it.