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

public IndexDefinition getIndex(String name);
Parameters
name String name of an index
Return Value
IndexDefinition Instance of IndexDefinition representing index.

Example

IndexDefinition index = store.getDatabaseCommands().getIndex("Orders/Totals");

GetIndexes

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

Syntax

public Collection<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
Collection<IndexDefinition> Collection of IndexDefinitions.

Example

Collection<IndexDefinition> indexes = store.getDatabaseCommands().getIndexes(0, 10);

GetIndexNames

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

Syntax

public Collection<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
Collection<String> This methods returns an array of index name as a result.

Example

Collection<String> indexNames = store.getDatabaseCommands().getIndexNames(0, 10);