Couchbase Index Definition

Hi Team,

Is there any way can we get the index definition without logging into the Couchbase UI or is there any NQL query to get those details?

Thanks,
Debasis

Check the Index Management APIs.

With this API method we will get the name and params but I need the create statement so that I will run the through Query work bench.

Thanks,
Debasis

can we get the index definition without logging into the Couchbase UI

hmm…

but I need the create statement so that I will run the through Query work bench.

If you’re using the Query work bench, aren’t you already logged into the Couchbase UI?

Which API method?

https://www.google.com/search?q=couchbase+index+management+REST+API
first link.

– OR –

https://www.google.com/search?q=couchbase+index+management+java+sdk+API

Second link:

https://docs.couchbase.com/sdk-api/couchbase-java-client/

Search for “query index management”

Takes you to com.couchbase.client.java.manager.query (Couchbase Java SDK 3.4.9 API)

On that page, click on QueryIndexManager

https://docs.couchbase.com/sdk-api/couchbase-java-client/com/couchbase/client/java/manager/query/QueryIndexManager.html

getAllIndexes returns a list of QueryIndex, the raw json is available from the raw() method.

curl -s Administrator:password@127.0.0.1:9102/getIndexStatus |jq '.status[].definition' | sed 's/^"//g' | sed 's/"$/;/g' | sed 's/\\"/"/g'

1 Like