indexes

The Indexes resource

The Indexes resource allows you to list the indexes of your collections.

The only allowed method is GET:

Method Description
GET Returns the indexes of the collection

The resource URI format is /<dbname>/<collname>/_indexes

Examples

get the list of the collection indexes

$ http GET 127.0.0.1:8080/test/coll/_indexes
HTTP/1.1 200 OK
...
{
    "_embedded": {
        "rh:index": [
            {
                "_type": "INDEX", 
                "key": {
                    "_etag": 1
                },
                ...
            }, 
            {
                "_id": "_id_", 
                }, 
                "key": {
                    "_id": 1
                },
                ...
            }, 
            {
                "_id": "_id_etag_idx", 
                "key": {
                    "_etag": 1, 
                    "_id": 1
                },
                ...
            }
        ]
    }, 
    ...
    "_returned": 3, 
    "_size": 3, 
    "_type": "COLLECTION_INDEXES"
}

Three default indexes exist in the collection:

  • {“_id”: 1}
  • {“etag”: 1}
  • {“_id”: 1, “_etag”: 1}

Refer to the MongoDB indexes documentation for more information.

Indexes can be created and deleted via the Index resource.

Documentation references

How to use the examples

The examples make use of the brilliant httpie CLI HTTP client and are ment to be used with RESTHeart stareted on the localhost without the authentication enabled.

Eventually pass username and password with the -a username:password option.