Get Indexes Operation


  • Use GetIndexesOperation to retrieve multiple index definitions from the database.

  • The operation will execute on the node defined by the client configuration.
    However, the index definitions returned are taken from the database record,
    which is common to all the database-group nodes.
    i.e., an index state change done only on a local node is not reflected.

  • To get a specific index state on a local node use GetIndexStatisticsOperation.

  • In this page:


Get indexes example

// Define the get indexes operation
// Pass number of indexes to skip & number of indexes to retrieve
var getIndexesOp = new GetIndexesOperation(0, 10);

// Execute the operation by passing it to Maintenance.Send
IndexDefinition[] indexes = store.Maintenance.Send(getIndexesOp);

// indexes will contain the first 10 indexes, alphabetically ordered by index name
// Access an index definition from the resulting list:
var name = indexes[0].Name;
var state = indexes[0].State;
var lockMode = indexes[0].LockMode;
var deploymentMode = indexes[0].DeploymentMode;
// etc.
// Define the get indexes operation
// Pass number of indexes to skip & number of indexes to retrieve
var getIndexesOp = new GetIndexesOperation(0, 10);

// Execute the operation by passing it to Maintenance.SendAsync
IndexDefinition[] indexes = await store.Maintenance.SendAsync(getIndexesOp);

// indexes will contain the first 10 indexes, alphabetically ordered by index name
// Access an index definition from the resulting list:
var name = indexes[0].Name;
var state = indexes[0].State;
var lockMode = indexes[0].LockMode;
var deploymentMode = indexes[0].DeploymentMode;
// etc.

Syntax

public GetIndexesOperation(int start, int pageSize)
Parameters Type Description
start int Number of indexes to skip
pageSize int Number of indexes to retrieve
Return value of store.Maintenance.Send(getIndexesOp)
IndexDefinition[] A list of IndexDefinition,
ordered alphabetically by index name.