Skip to main content

Enable Index Operation

How to enable an index​

  • From the Client API:
    Use EnableIndexOperation to enable the index from the Client API.
    The index can be enabled:

    • On a single node.
    • Cluster wide, on all database-group nodes.
  • From Studio:
    To enable the index from Studio go to the indexes list view.

  • Reset index:
    Resetting a disabled index will re-enable the index locally, on the node that the reset operation was performed on.

  • Modify index definition:
    Modifying the index definition will also re-enable the normal operation of the index.

  • The above methods can also be used to enable an index that was disabled via the file system, after removing the disable.marker file.

Enable index from the Client API​

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 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

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

Syntax:​

// Available overloads:
public EnableIndexOperation(string indexName)
public EnableIndexOperation(string indexName, bool clusterWide)
ParametersTypeDescription
indexNamestringName of index to enable
clusterWidebooltrue - Enable index on all database-group nodes
false - Enable index only on a single node (the preferred node)

In this article