Not able to import indexes to couchbase 7.0.0 using cbimport

Hi Team,

When I am trying to load indexes from the .zip, they are not getting imported. This is the command we are using.

sudo /opt/couchbase/bin/cbimport json -c couchbase://localhost:8091 -u username -p password -b wagglebeecache -d file:///cbdata/wagglebeecache.zip -f sample -v

My Folder structure of the zip is as follows
docs → (Empty)
indexes.json

The indexes.json has the following content.

{"statements":[{"statement":"CREATE PRIMARY INDEX `idx_wagglebeecache_primary` ON `wagglebeecache` WITH {'defer_build':true}","args":null},{"statement":"CREATE INDEX `idx_wagglebeecache_typeName` ON `wagglebeecache`(`typeName`) USING GSI WITH {'defer_build':true}","args":null},{"statement":"CREATE INDEX idx_wagglebeecache_contentcache_swarmId_sequenceNumber_desc ON `wagglebeecache`(`swarmId`,`sequenceNumber` desc) WHERE (`typeName` = 'contentcache' ) USING GSI WITH {'defer_build':true}","args":null},{"statement":"BUILD INDEX ON `wagglebeecache` ( ( SELECT RAW name FROM system:indexes WHERE keyspace_id = 'wagglebeecache' AND state = 'deferred' ));","args":null}]}

Would you please assist as I am not able to get a clear picture of what is happening? Previously we used to load the indexes using cbdocloader, and now it says it was deprecated and even this is also not importing the indexes.

Hi @Manoj_Pasumarthi,

The indexes.json file must exist in a directory called design_docs for the sample importer to read then execute the given queries.

For example, if we look at the beer-sample we’re able to see the following:

$ unzip -q -c beer-sample.zip 'beer-sample/design_docs/indexes.json' | jq
{
  "statements": [
    {
      "statement": "CREATE PRIMARY INDEX beer_primary on `@BUCKET_NAME@` USING GSI WITH {\"defer_build\":true}",
      "args": null
    },
    {
      "statement": "BUILD INDEX ON `@BUCKET_NAME@`(beer_primary) USING GSI",
      "args": null
    }
  ]
}

For reference, the cbdocloader documentation has an overview of the sample format.

Thanks,
James

Hi @jamesl33,

Thank you. It worked.