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: Indexes: Get

There are few methods that allow you to retrieve an index from a database:
- GetIndex
- GetIndexes
- GetIndexNames

GetIndex

GetIndex is used to retrieve an index definition from a database.

Syntax

IndexDefinition GetIndex(string name);

Parameters
name string name of an index
Return Value
IndexDefinition Instance of IndexDefinition representing index.

Example

IndexDefinition index = store.DatabaseCommands.GetIndex("Orders/Totals");

GetIndexes

GetIndexes is used to retrieve multiple index definitions from a database.

Syntax

IndexDefinition[] GetIndexes(int start, int pageSize);

Parameters
start string Number of indexes that should be skipped
pageSize int Maximum number of indexes that will be retrieved
Return Value
IndexDefinition Instance of IndexDefinition representing index.

Example

IndexDefinition[] indexes = store.DatabaseCommands.GetIndexes(0, 10);

GetIndexNames

GetIndexNames is used to retrieve multiple index names from a database.

Syntax

string[] GetIndexNames(int start, int pageSize);

Parameters
start string Number of index names that should be skipped
pageSize int Maximum number of index names that will be retrieved
Return Value
string[] This methods returns an array of index name as a result.

Example

string[] indexNames = store.DatabaseCommands.GetIndexNames(0, 10);