You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.0 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

public void startIndexing();

public void startIndexing(Integer maxNumberOfParallelIndexTasks);
Parameters
maxNumberOfParallelIndexTasks Integer if set then maximum number of parallel indexing tasks will be set to this value

Example

store.getDatabaseCommands().getAdmin().startIndexing();

StopIndexing

This methods stops indexing, if it was running.

Syntax

public void stopIndexing();

Example

store.getDatabaseCommands().getAdmin().stopIndexing();

GetIndexingStatus

This methods retrieves current status of the indexing.

Syntax

public String getIndexingStatus();
Return Value
String "Indexing" if the indexing is running, "Paused" otherwise.

Example

store.getDatabaseCommands().getAdmin().stopIndexing();
assertEquals("Paused", store.getDatabaseCommands().getAdmin().getIndexingStatus());
store.getDatabaseCommands().getAdmin().startIndexing();
assertEquals("Indexing", store.getDatabaseCommands().getAdmin().getIndexingStatus());