This version of the documentation is archived and no longer supported. It will be removed on 01 March 2021. To learn how to upgrade your version of MongoDB Ops Manager, refer to the upgrade documentation.
You were redirected from a different version of the documentation. Click here to go back.

Get Existing Indexes for a Project


Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project id. For existing groups, your group/project id remains the same. This page uses the more familiar term group when referring to descriptions. The endpoint remains as stated in the document.

Base URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0

Retrieves the indexes that exist for all collections or specified collections on a specified host. Keys in indexes with multiple keys appear in the same order that they appear in the index. For more information, see Performance Advisor.


GET /groups/{GROUP-ID}/hosts/{HOST-ID}/performanceAdvisor/existingIndexes

Request Path Parameters

Path Element Description
GROUP-ID The unique identifier for the project where the the MongoDB host resides.
HOST-ID The unique identifier for the host of a MongoDB process. For information about retrieving host ids, see Get All Hosts in a Group.

Request Query Parameters

Field Optional/Required Type Description
namespaces Optional string

A namespace for a collection for which you want to retrieve existing indexes on the specified host. To specify multiple namespaces, pass the parameter multiple times using an ampersand (&) as a delimiter, once for each namespace.



If you do not specify this parameter, the endpoint return all namespaces for the corresponding collection on the specified host.

envelope Optional boolean Specifies whether or not to wrap the response in an envelope. The default is false.
pretty Optional boolean Indicates whether the response body should be in a prettyprint format. The default value is false.

Request Body Parameters

This endpoint does not use HTTP request body parameters.

Response Elements

Field Type Description
collectedIndexes array Each array element represents one index.
collectedIndexes[i].index array

Each array element is a document that specifies a key in the index and its sort order, ascending or descending.

  • A value of 1 indicates an ascending sort order.
  • A value of -1 indicates a descending sort order.

Keys in indexes with multiple keys appear in the same order that they appear in the index.

collectedIndex[i].namespace string The namespace corresponding to the collection to which the index belongs. Namespaces appear in the following format: {database.collection}

Example Request

curl -i --digest -u "{username}:{apiKey}" \

Example Response

  "collectedIndexes" : [ {
    "index" : [ {
      "_id" : "1"
    } ],
    "namespace" : "data.stocks"
  }, {
    "index" : [ {
      "Ticker" : "1"
    } ],
    "namespace" : "data.stocks"
  }, {
    "index" : [ {
      "_id" : "1"
    } ],
    "namespace" : "data.zips"
  }, {
    "index" : [ {
      "city" : "1"
    }, {
      "state" : "1"
    } ],
    "namespace" : "data.zips"
  } ]