You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Commands: How to start or stop indexing and get indexing status?

Following commands have been created to enable user to toggle indexing and retrieve indexing status:
- StartIndexing
- StopIndexing
- GetIndexingStatus

StartIndexing

This methods starts indexing, if it was previously stopped.

Syntax

void StartIndexing(int? maxNumberOfParallelIndexTasks = null);

Parameters
maxNumberOfParallelIndexTasks int? if set then maximum number of parallel indexing tasks will be set to this value

Example

store.DatabaseCommands.Admin.StartIndexing();

StopIndexing

This methods stops indexing, if it was running.

Syntax

void StopIndexing();

Example

store.DatabaseCommands.Admin.StopIndexing();

GetIndexingStatus

This methods retrieves current status of the indexing.

Syntax

string GetIndexingStatus();

Return Value
string "Indexing" if the indexing is running, "Paused" otherwise.

Example

store.DatabaseCommands.Admin.StopIndexing();
string status = store.DatabaseCommands.Admin.GetIndexingStatus(); // "Paused"
store.DatabaseCommands.Admin.StartIndexing();
status = store.DatabaseCommands.Admin.GetIndexingStatus(); // "Indexing"