- API >
- API Resources >
- Performance Advisor >
- Get Suggested Indexes
Get Suggested Indexes¶
On this page
Retrieves any suggested indexes generated by the Atlas Performance Advisor.
Note
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. The resource and corresponding endpoints use the
term groups
.
The Atlas API uses HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.
For complete documentation on configuring API access for an Atlas project, see Configure Atlas API Access.
Base URL: https://cloud.mongodb.com/api/atlas/v1.0
Resource¶
Request Path Parameters¶
Path Element | Description |
---|---|
GROUP-ID |
Unique identifier for the project. |
PROCESS-ID |
The Atlas hostname and port, e.g.
m10-shard-00-00-17jcm.mongodb.net:27017 . To retrieve all
processes in the project with a given GROUP-ID , use the
/groups/{GROUP-ID}/processes endpoint. |
Request Query Parameters¶
All parameters are optional.
Path Element | Type | Description |
---|---|---|
since |
long | Point in time from which to retrieve suggested indexes, stated in milliseconds since epoch. |
duration |
long | Length of time in milliseconds during which to find suggested indexes among the managed namespaces in the cluster. |
namespaces |
string | Namespaces from which to retrieve suggested indexes. A namespace
consists of the database and collection resource separated by a
To specify multiple namespaces, pass the parameter multiple times
using an ampersand ( Example ?namespaces=data.stocks&namespaces=data.zips&pretty=true Omit to return results for all namespaces. |
nIndexes |
long | Maximum number of indexes to suggest. Defaults to unlimited. |
nExamples |
long | Maximum number of examples queries to provide that will be
improved by a suggested index. Defaults to 5 . |
pretty |
boolean | Display response in a prettyprint
format. Defaults to false . |
envelope |
boolean | Specifies whether or not to wrap the response in an
envelope. Defaults to false . |
Note
If since
is indicated and duration
is omitted,
the response contains results from the since
point
up to the present time.
If duration
is indicated and
since
is omitted, the response contains results from
duration
ms ago through the present time.
If both since
and duration
are omitted, the response
contains results from the previous 24 hours up
through the present time.
Request Body Parameters¶
This endpoint does not use HTTP request body parameters.
Response¶
Name | Type | Description |
---|---|---|
shapes |
array of documents | Documents with information about the query shapes that are served by the suggested indexes. |
shapes[n].avgMs |
number | Average duration in milliseconds for the queries examined that match this shape. |
shapes[n].count |
number | Number of queries examined that match this shape. |
shapes[n].id |
objectId | Unique id for this shape. Exists only for the duration of the API request. |
shapes[n].inefficiencyScore |
number | Average number of documents read for every document returned by the query. For more information, see Understanding the Query Inefficiency Score. |
shapes[n].namespace |
string | Namespace searched by the queries in this shape. |
shapes[n].operations |
array of documents | Documents with specific information and log lines for individual queries. |
shapes[n].operations[n].predicates |
array of documents | Documents containing the search criteria used by the query. Values in key-value pairs will be redacted in these predicates unless the user has Project Data Access Read Only permissions or higher. |
shapes[n].operations[n].raw |
string | Raw log line produced by the query. |
shapes[n].operations[n].stats |
document | Query statistics. |
shapes[n].operations[n].stats.ms |
number | Duration in milliseconds of the query. |
shapes[n].operations[n].stats.nReturned |
number | Number of results returned by the query. |
shapes[n].stats.nScanned |
number | Number of documents read by the query. |
shapes[n].stats.ts |
number | Query timestamp, in seconds since epoch. |
suggestedIndexes |
array of documents | Documents with information about the indexes suggested by the Performance Advisor. |
suggestedIndexes[n].id |
objectId | Unique id for this suggested index. |
suggestedIndexes[n].impact |
array of objectIds | List of unique identifers which correspond the query shapes in this response which pertain to this suggested index. Note This field does not correspond to Impact in the Performance Advisor user interface. |
suggestedIndexes[n].index |
array of documents | Each array element is a document that specifies a key in the index and its sort order, ascending or descending.
Keys in indexes with multiple keys appear in the same order that they appear in the index. |
suggestedIndexes[n].index.<fieldname> |
string | Specific field to be indexed. |
suggestedIndexes[n].namespace |
string | Namespace of the suggested index. |
suggestedIndexes[n].weight |
number | Estimated percentage performance improvement that the suggested index would provide. Corresponds to Impact in the Performance Advisor user interface. |