Enable Index Operation
-
When an index is enabled, indexing will take place, and new data will be indexed.
-
To learn how to disable an index, see disable index.
-
In this page:
How to enable an index
-
From the Client API:
UseEnableIndexOperation
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 args set to enable on a single node
enable_index_op = EnableIndexOperation("Orders/Totals")
# Execute the operation by passing it to maintenance.send
store.maintenance.send(enable_index_op)
# At this point, the index is enabled only on the 'preferred node'
# New data will not be indexed on this node only
Enable index - cluster wide:
# Define the enable index operation
# Pass 'True' to enable the index on all nodes in the database-group
enable_index_op = EnableIndexOperation("Orders/Totals", True)
# Execute the operation by passing it to maintenance.send
store.maintenance.send(enable_index_op)
# At this point, the index is enabled on ALL nodes
# New data will not be indexed
Syntax:
class EnableIndexOperation(VoidMaintenanceOperation):
def __init__(self, index_name: str, cluster_wide: bool = False): ...
Parameters | Type | Description |
---|---|---|
index_name | str |
Name of index to enable |
cluster_wide | bool |
True - Enable index on all database-group nodesFalse - Enable index only on a single node (the preferred node) |