Disable Index Operation
-
Use
DisableIndexOperation
to disable a specific index. -
The index can be disabled either:
- On a single node, or
- Cluster wide - on all database-group nodes.
-
When index is disabled:
- No indexing will take place, new data will not be indexed.
- 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 enable back the index use enable index operation.
- To only pause indexing and resume after a restart go to: stop index operation.
-
Disabling/enabling an index can also be done from the indexes list view in the Studio.
-
In this page:
Disable index - single node
-
With this option, the index will be disabled on the preferred node only.
The preferred node is simply the first node in the database group topology. -
Note: When disabling an index from the Studio,
you can disable it on the local node the browser is opened on, even if it is Not the preferred node.
// 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
// 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
// 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
// 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) |