Enable Index Operation


  • Use EnableIndexOperation to enable a specific index.

  • The index can be enabled either:

    • On a single node, or
    • Cluster wide - on all database-group nodes.
  • When index is enabled indexing will take place, new data will be indexed.

  • To disable the index use disable index operation.
    Disabling/enabling an index can also be done from the indexes list view in the Studio.

    An index may also be manually disabled through the file system.
    Learn here how to enable an index that was disabled this way.

  • In this page:


Enable index - single node

  • With this option, the index will be enabled on the preferred node only.
    The preferred node is simply the first node in the database group topology.

  • Note: When enabling an index from the Studio,
    the index will be enabled on the local node the browser is opened on, even if it is Not the preferred node.

// Define the enable index operation
// Use this overload to enable on a single node
var enableIndexOp = new EnableIndexOperation("Orders/Totals");

// Execute the operation by passing it to Maintenance.Send
store.Maintenance.Send(enableIndexOp);

// At this point, the index is enabled on the 'preferred node'
// New data will be indexed on this node
// Define the enable index operation
// Use this overload to enable on a single node
var enableIndexOp = new EnableIndexOperation("Orders/Totals");

// Execute the operation by passing it to Maintenance.SendAsync
await store.Maintenance.SendAsync(enableIndexOp);

// At this point, the index is enabled on the 'preferred node'
// New data will be indexed on this node

Enable index - cluster wide

// Define the enable index operation
// Pass 'true' to enable the index on all nodes in the database-group
var enableIndexOp = new EnableIndexOperation("Orders/Totals", true);

// Execute the operation by passing it to Maintenance.Send
store.Maintenance.Send(enableIndexOp);

// At this point, the index is enabled on all nodes
// New data will be indexed
// Define the enable index operation
// Pass 'true' to enable the index on all nodes in the database-group
var enableIndexOp = new EnableIndexOperation("Orders/Totals", true);

// Execute the operation by passing it to Maintenance.SendAsync
await store.Maintenance.SendAsync(enableIndexOp);

// At this point, the index is enabled on all nodes
// New data will be indexed

Syntax

// Available overloads:
public EnableIndexOperation(string indexName)
public EnableIndexOperation(string indexName, bool clusterWide)
Parameters Type Description
indexName string Name of index to enable
clusterWide bool true - Enable index on all database-group nodes
false - Enable index only on a single node (the preferred node)