ODBC Driver for Couchbase

Build 23.0.8839

ManageIndices

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

インデックスの構築

匿名のプライマリインデックスはこれらのパラメータで作成できます。

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

これは、このN1QL を実行することと同じです。

CREATE PRIMARY INDEX ON `Players` USING VIEW

上記のパラメータに加えて、@Name を指定することで名前付きプライマリインデックスを作成できます。

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

セカンダリインデックスは、@IsPrimary をfalse に設定して、少なくとも1つの式を指定することで作成できます。

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

これは、次のN1QL を実行することと同じです。

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

複数のノードとフィルタを指定して、より複雑なインデックスを生成することもできます。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"]'

これは、次の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.

デフォルト値は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.

デフォルト値は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) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839