I am working on getting all indexes scripted from one environment from other. I can get indexes names from below query by specifying bucket:
select RAW name from system:indexes where keyspace_id=‘namedDB’
Now my question is there any way that i can get Index definition using N1ql as in sql server we used to do sp_helptext’Indexname’ It will show index definition.Is there any way in N1ql.If not how to extract definition of all indexes at once rather than going one by one.
Thanks Ritz
There is no direct statement in the N1QL. You need to build the statement using system:indexes.
You Can try one of the following option
Run the following command on each index node https://docs.couchbase.com/server/5.5/rest-api/get-statement-indexes.html
curl -v Administrator:password@127.0.0.1:9102/getIndexStatement
Use UI copy all definitions
Add whitelist described in Security section of https://docs.couchbase.com/server/5.5/n1ql/n1ql-language-reference/curl.html
SELECT RAW re FROM CURL("http://Administrator:password@127.0.0.1:9102/getIndexStatement",{}) AS re ;