Humberto Corrêa
Humberto Corrêa

Reputation: 839

Is it possible to create a primary index for N1QL via REST API?

I'm using Couchbase Server 4.6.4 and I'd like to create a primary index for N1QL via REST API to automate my provision. Is it possible? I got it via web console.

Thanks

Upvotes: 0

Views: 245

Answers (2)

deniswsrosa
deniswsrosa

Reputation: 2460

If you want to automate the creation of indexes, you can add a class that automatically create everything during the startup:

Java Example: https://github.com/couchbaselabs/try-cb-java/blob/master/src/main/java/trycb/util/StartupPreparations.java

UPDATE: removed my comment as I thought it wasn't possible.

Upvotes: 0

EbenH
EbenH

Reputation: 566

You can use the query service REST API (which is on port 8093 by default. E.g.,

curl http://don:[email protected]:8093/query/service?statement=create%20primary%20index%20on%20default

Upvotes: 2

Related Questions