Administration: Index Administration
RavenDB indexes can be administrated easily by the user with the Studio or via maintenance operations in the Client API.
Stop & Start
Stopping the indexing for a database will result in pausing all indexes. You can do that using the Studio or the Client API. The same way you can resume it (the operation to start indexing can be found here).
You can also stop and start a single index. The Client API operations are StopIndex and StartIndex.
Indexing will be resumed automatically after a server restart.
Operation scope: Local node
Disable & Enable
Disabling an index can be done via the Studio or the Client API operations: DisableIndex, EnableIndex.
Querying a disabled index is allowed but it may return stale results. Unlike stopping the index (pausing), disabling is a persistent operation so the index remains disabled even after a server restart.
Operation scope: Local node
Reset
An index usually needs to be reset once it reached its error quota and its state was changed to Error
. Resetting an index means forcing RavenDB to re-index all documents
matched by the index definition (can be a lengthy process on large databases).
You can reset an index using the Studio or the Client API.
Operation scope: Local node
Delete
You can delete an index by using the Studio or the Client API.
Operation scope: Cluster
Lock Mode
This feature applies to changing the index definition on a production server.
An index can be in one of the following locking modes:
* Unlocked - Any change to the index defintion is applied.
* LockedIgnore - Modifications to the index definition will not be applied. Changes are ignored and no error is thrown.
* LockedError - Modifications are ignored but an error is raised.
A typical flow can be:
-
Update the index definition on RavenDB server (from studio or from a new application version),
and then set the index Lock Mode toLockedIgnore
orLockedError
. -
A side-by-side index is created on the server. It indexes your dataset according to the new definition.
-
While the original index is locked, if any instance of your previous application version (that has the older definition) is restarted, calling IndexCreation.CreateIndexes() on start up, this will not have any effect on the new index definition.
Note: If 'LockedError' was set, then an error will be raised. -
Once the side-by-side index is done indexing, the original index will be replaced and you can safely deploy your new application to production.
To lock the index you can use the Studio
or the Client API.
Note: This is not a security feature, an index can be unlocked at any time.
Operation scope: Cluster
Priority
Each index has a dedicated thread that handles all the work for the index. RavenDB uses thread priorities at the operating system level to hint what should be done first. You can increase or lower the index priority and RavenDB will update the indexing thread accordingly:
RavenDB Index Priority | OS Thread Priority |
---|---|
Low | Lowest |
Normal (default) | BelowNormal |
High | Normal |
You can change the index priority by using the Studio or the Client API.
Expert configuration options
You can control the affinity of indexing threads and number of cores that won't be used by indexes via the following configurations:
Operation scope: Cluster