Disable Index Operation
-
Use
DisableIndexOperation
to disable a specific index. -
In this page:
Overview
On which node the index is disabled:
-
The index can be disabled either:
- On a single node, or
- Cluster wide - on all database-group nodes.
-
When disabling the index from the client on a single node:
The index will be disabled on the preferred node only, and Not on all the database-group nodes. -
When disabling an index from the Studio (from the indexes list view),
The index will be disabled on the local node the browser is opened on, even if it is Not the preferred node.
When index is disabled:
-
No indexing will be done by a disabled index on the node where index is disabled.
However, new data will be indexed by the index on other database-group nodes where it is not disabled. -
You can still query the index,
but results may be stale when querying a node on which the index was disabled. -
Disabling an index is a persistent operation:
- The index will remain disabled even after restarting the server or after disabling/enabling the database.
- To only pause the index and resume after a restart see: pause index operation.
How to enable the index:
-
To enable the index from the client - see enable index operation.
-
To enable the index from the Studio - go to the indexes list view.
-
Resetting a disabled index will enable the index back
on the local node where the reset action was performed. -
Modifying the index definition will also enable back the normal operation of the index.
Disable index - single node
// Define the disable index operation
// Use this overload to disable on a single node
var disableIndexOp = new DisableIndexOperation("Orders/Totals");
// Execute the operation by passing it to Maintenance.Send
store.Maintenance.Send(disableIndexOp);
// At this point, the index is disabled only on the 'preferred node'
// New data will not be indexed on this node only
// Define the disable index operation
// Use this overload to disable on a single node
var disableIndexOp = new DisableIndexOperation("Orders/Totals");
// Execute the operation by passing it to Maintenance.SendAsync
await store.Maintenance.SendAsync(disableIndexOp);
// At this point, the index is disabled only on the 'preferred node'
// New data will not be indexed on this node only
Disable index - cluster wide
// Define the disable index operation
// Pass 'true' to disable the index on all nodes in the database-group
var disableIndexOp = new DisableIndexOperation("Orders/Totals", true);
// Execute the operation by passing it to Maintenance.Send
store.Maintenance.Send(disableIndexOp);
// At this point, the index is disabled on all nodes
// New data will not be indexed
// Define the disable index operation
// Pass 'true' to disable the index on all nodes in the database-group
var disableIndexOp = new DisableIndexOperation("Orders/Totals", true);
// Execute the operation by passing it to Maintenance.SendAsync
await store.Maintenance.SendAsync(disableIndexOp);
// At this point, the index is disabled on all nodes
// New data will not be indexed
Syntax
// Available overloads:
public DisableIndexOperation(string indexName)
public DisableIndexOperation(string indexName, bool clusterWide)
Parameters | Type | Description |
---|---|---|
indexName | string | Name of index to disable |
clusterWide | bool | true - Disable index on all database-group nodesfalse - Disable index only on a single node (the preferred node) |