TDV Adapter for Couchbase

Build 22.0.8462

ManageIndices

Creates/Drops an index in a target bucket in Couchbase.

Building Indices

An anonymous primary index can be created with these parameters:

EXECUTE ManageIndices
  @BucketName = 'Players'
  @Action = 'CREATE'
  @IsPrimary = 'true'
  @IndexType = 'VIEW'

This is the same as executing this N1QL:

CREATE PRIMARY INDEX ON `Players` USING VIEW

A named primary index can be created by specifying an @Name, in addition to the parameters listed above:

EXECUTE ManageIndices
  @BucketName = 'Players'
  @Action = 'CREATE'
  @IsPrimary = 'true'
  @Name = 'Players_primary'
  @IndexType = 'VIEW'

A secondary index can be created by setting @IsPrimary to false and providing at least one expression.

EXECUTE ManageIndices
  @BucketName = 'Players',
  @Action = 'CREATE',
  @IsPrimary = 'false',
  @Name = 'Players_playtime_score',
  @Expressions = '["score", "playtime"]'

This is the same as running the following N1QL:

CREATE INDEX `Players_playtime_score` ON `Players`(score, playtime) USING GSI;

Multiple nodes and filters can also be provied to generate more complex indices. They must be provided as JSON lists:

EXECUTE ManageIndices
  @BucketName = 'Players',
  @Name = 'TopPlayers',
  @Expressions = '["score", "playtime"]',
  @Filter = '["topscore > 1000", "playtime > 600"]',
  @Nodes = '["127.0.0.1:8091", "192.168.0.100:8091"]'

This is the same as running the following N1QL:

CREATE INDEX `TopPlayers` ON `Players`(score, playtime) WHERE topscore > 1000 AND playtime > 600 USING GSI WITH { "nodes": ["127.0.0.1:8091", "192.168.0.100:8091"]};

Input

Name Type Required Description
BucketName String True The target bucket to create or drop the the index from.
ScopeName String False The target scope to create or drop the index from (Couchbase 7 and up)
CollectionName String False The target collection to create or drop the index from (Couchbase 7 and up)
Action String True Specifies which action to perform on the index, can be Create or Drop.
Expressions String False A list of expressions or functions, encoded as JSON, that the index will be based off of. At least one is required if IsPrimary is set to false and the action is Create.
Name String False The name of the index to create or drop, required if IsPrimary is set to false.
IsPrimary String False Specifies wether the index should be a primary index.

The default value is true.

Filters String False A list of filters, encoded as JSON, to apply on the index.
IndexType String False The type of index to create, can be GSI or View, only used if the action is Create.

The default value is GSI.

ViewName String False Deprecated, included for compatibility only. Does nothing.
Nodes String False A list, encoded as JSON, of nodes to contain the index, must contain the port. Only used if the action is Create.
NumReplica String False How many replicas to create among the index nodes in the cluster.

Result Set Columns

Name Type Description
Success String Whether or not the index was successfully created or dropped.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462