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

curl \
	http://{serverName}/databases/{databaseName}/indexes/{indexName}?definition=yes \
	-X GET

Request

Query parameter Required Description
indexName Yes Name of an index

Response

Status code Description
200 OK
Return Value Description
Index IndexDefinition json

Example I

Get Orders/Totals index.

curl -X GET "http://localhost:8080/databases/NorthWind/indexes/Orders/Totals?definition=yes"
< HTTP/1.1 200 OK
{"Index":
	{"IndexId":6,
	"Name":"Orders/Totals",
	"LockMode":"Unlock",
	"Map":" from order in docs.Orders  
		select new  {    
			order.Employee,    
			order.Company,    
			Total = order.Lines.Sum(l => (l.Quantity * l.PricePerUnit) * (1 - l.Discount))}",
	"Maps":[
		" from order in docs.Orders  select new  {     
			order.Employee,    
			order.Company,    
			Total = order.Lines.Sum(l => (l.Quantity * l.PricePerUnit) * (1 - l.Discount))}"],
	"Reduce":null,
	"IsMapReduce":false,
	"IsCompiled":false,
	"Stores":{},
	"Indexes":{},
	"SortOptions":{},
	"Analyzers":{},
	"Fields":["Total","__document_id","Employee","Company"],
	"Suggestions":{},
	"TermVectors":{},
	"SpatialIndexes":{},
	"InternalFieldsMapping":null,
	"MaxIndexOutputsPerDocument":null,
	"Type":"Map",
	"DisableInMemoryIndexing":false
	}
}

GetIndexes

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

Syntax

curl \
	http://{serverName}/databases/{databaseName}/indexes/ \
		&start={start} \
		&pageSize={pageSize} \
	-X GET

Request

Query parameter Required Description
start No Number of indexes that should be skipped
pageSize No Maximum number of indexes that will be retrieved

Response

Status code Description
200 OK
Return Value Description
payload Array of IndexDefinition

Example I

Get up to 10 index definitions

curl -X GET "http://localhost:8080/databases/NorthWind/indexes/?start=0&pageSize=10"
< HTTP/1.1 200 OK
[ indexDefinition, indexDefinition, ... ]

GetIndexNames

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

Syntax

curl \
	http://{serverName}/databases/{databaseName}/indexes/? \
		namesOnly=true \
		&start={start} \
		&pageSize={pageSize} \
	-X GET

Request

Query parameter Required Description
start No Number of index names that should be skipped
pageSize No Maximum number of index names that will be retrieved

Response

Status code Description
200 OK
Return Value Description
payload list of strings: index names

Example I

Gets up to 10 index names.

curl -X GET "http://localhost:8080/databases/NorthWind/indexes/?namesOnly=true&start=0&pageSize=10" 
< HTTP/1.1 200 OK
["Orders/ByCompany","Orders/Total2s","Orders/Totals","Product/Sales","Raven/DocumentsByEntityName"]