Skip to main content

Index Service

The index resource allows you to manage the indexes on your services to speed up queries

Index REST API

The Index REST API is a full CRUD API allowing you to search and filter indexes as well as update and delete them. It is accessed through the following URL:

https://api.opendatadsl.com/api/index

The API consists of the following calls:

MethodPathExampleDescription
GETGet build information for this service
GET{release}v1List all indexes on master data service
GET{release}/{service}v1List all indexes on the named service
GET{release}/{service}/{id}v1/object/_id_Get a specific index on the specified service
POST{release}v1Add/update an index, the body is the index definition
DELETE{release}/{service}/{id}v1/object/_testDelete the named index on the specified service

Index definition

NameDescriptionType
nameThe name for the indexString
keyAn object defining the keys to useObject
sourceThe service for the index, defaults to objectString
uniqueA boolean indicating that all values in the index must be unique, defaults to falseBoolean
sparseSparse indexes only contain entries for documents that have the indexed field. These indexes skip documents that do not have the indexed field.Boolean
hiddenHidden indexes are not visible to the query planner and cannot be used to support a query. You can use hidden indexes to evaluate the potential impact of dropping an index without actually dropping it. If the impact is negative, you can unhide the index instead of having to recreate a dropped index. Hidden indexes are fully maintained and can be used immediately once unhidden.Boolean
expireAfterSecondsUse this to automatically remove documents from a collection after a certain amount of time. Use these indexes for data that only needs to persist for a finite amount of time, like machine generated event data, logs, and session information.Integer
partialFilterExpressionPartial indexes only index the documents in a collection that meet a specified filter expression. Partial indexes have lower storage requirements and reduced performance costs for index creation and maintenance. Partial indexes offer a superset of the functionality of sparse indexes and should be preferred over sparse indexes.Object
collationOptional. Specifies the collation for the index. Collation allows users to specify language-specific rules for string comparison, such as rules for lettercase and accent marks.Object

Examples

### List all indexes on master data
GET {{url}}/index/v1
Authorization: Bearer {{token}}

### List all indexes on events
GET {{url}}/index/v1/event
Authorization: Bearer {{token}}

### Get an index
GET {{url}}/index/v1/object/_id_
Authorization: Bearer {{token}}

### Add an index
POST {{url}}/index/v1
Authorization: Bearer {{token}}

{
"name": "name",
"key": {
"dataset":1
}
}

### Delete an index on the master data service
DELETE {{url}}/index/v1/object/name
Authorization: Bearer {{token}}