检索由Performance Advisor确定的建议索引。
基本 URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0
Resource
GET /groups/{PROJECT-ID}/hosts/{HOST-ID}/performanceAdvisor/suggestedIndexes 
请求路径参数
| Parameter | 类型 | 说明 | 
|---|---|---|
| PROJECT-ID | 字符串 | (必需。) 拥有此 MongoDB 进程的项目的唯一标识符。 | 
| HOST-ID | 字符串 | (必需。) MongoDB 进程的主机的唯一标识符。 | 
请求查询参数
所有参数都是可选的。
| pretty | 布尔 | 指示响应正文是否应采用美观打印格式。 | 
 | |
| envelope | 布尔 | 指示是否要将响应封装在信封中。 | 
 | |
| since | long | 前24小时 | ||
| duration | long | 在集群托管命名空间中查找建议索引的时间长度(以毫秒为单位)。 | 截至目前 | |
| namespaces | 字符串 | 要从中检索建议索引的命名空间。 命名空间由由 要指定多个命名空间,请使用与符号 (  例如:  | 所有 | |
| nIndexes | long | 建议的最大索引数。 | 无限制 | |
| nExamples | long | 将通过建议的索引改进的最大示例查询数。 | 5 | 
请求正文参数
此端点不使用 HTTP 请求正文参数。
响应
| 名称 | 类型 | 说明 | 
|---|---|---|
| 
 | 文档数组 | 包含有关建议索引所服务的查询结构的信息的文档。 | 
| 
 | 数字 | 与此形状匹配的已检查查询的平均持续时间(以毫秒为单位)。 | 
| 
 | 数字 | 已检查的与此形状匹配的查询数量。 | 
| 
 | ObjectId | 此形状的唯一 ID。 仅在 API 请求期间存在。 | 
| 
 | 数字 | 查询返回的每个文档的平均读取文档数。 有关详细信息,请参阅了解查询低效率分数。 | 
| 
 | 字符串 | 此结构中的查询搜索的命名空间。 | 
| 
 | 文档数组 | 包含针对各个查询的特定信息和日志行的文档。 | 
| 
 | 文档数组 | 包含查询使用的Atlas Search条件的文档。 键值对中的值将在这些谓词中进行编辑,除非用户具有“项目数据访问只读”权限或更高权限。 | 
| 
 | 字符串 | 查询生成的原始日志行。 | 
| 
 | 文档 | 查询统计信息。 | 
| 
 | 数字 | 查询的持续时间(以毫秒为单位)。 | 
| 
 | 数字 | 查询返回的结果数。 | 
| 
 | 数字 | 查询读取的文档数。 | 
| 
 | 数字 | 查询时间戳,以自纪元以来的秒数为单位。 | 
| 
 | 文档数组 | 包含Performance Advisor建议的索引信息的文档。 | 
| 
 | ObjectId | 此建议索引的唯一 ID。 | 
| 
 | objectId大量 | 与此响应中与此建议索引相关的查询形状相对应的唯一标识符列表。 此字段与Performance Advisor用户界面中的 Impact不对应。 | 
| 
 | 文档数组 | 每个数组元素都是一个文档,指定索引中的键及其排序顺序(升序或降序)。 
 具有多个键的索引中的键的显示顺序与其在索引中的显示顺序相同。 | 
| 
 | 字符串 | 要索引的特定字段。 | 
| 
 | 字符串 | 建议索引的命名空间。 | 
| 
 | 数字 | 建议的索引将提供的估计性能改进百分比。 对应于 用户界面中的 影响 Performance Advisor。 | 
请求示例
curl --user '{PUBLIC-KEY}:{PRIVATE-KEY}' --digest \  --header 'Accept: application/json' \  --include \  --request GET 'https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{PROJECT-ID}/hosts/{HOST-ID}/performanceAdvisor/suggestedIndexes?pretty=true' 
响应示例
响应标头
 401 Unauthorized Content-Type: application/json;charset=ISO-8859-1 Date: {dateInUnixFormat} WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false Content-Length: {requestLengthInBytes} Connection: keep-alive 
 200 OK Vary: Accept-Encoding Content-Type: application/json Strict-Transport-Security: max-age=300 Date: {dateInUnixFormat} Connection: keep-alive Content-Length: {requestLengthInBytes} X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion} 
响应体
{   "shapes" : [ {     "avgMs" : 42,     "count" : 2,     "id" : "5b74689a80eef53f3388897e",     "inefficiencyScore" : 50000,     "namespace" : "test.users",     "operations" : [ {       "predicates" : [{ "find" : { "emails" : "la@sa.kp" } }],       "raw" : "2018-08-15T17:14:11.115+0000 I COMMAND  [conn4576] command test.users appName: \"MongoDB Shell\" command: find { find: \"users\", filter: { emails: \"la@sa.kp\" }, lsid: { id: UUID(\"1a4e71d3-9b67-4e9c-b078-9fdf3fae9091\") }, $clusterTime: { clusterTime: Timestamp(1534353241, 1), signature: { hash: BinData(0, AB91938B7CF7BC87994A2909A98D87F29101EFA0), keyId: 6589681559618453505 } }, $db: \"test\" } planSummary: COLLSCAN keysExamined:0 docsExamined:50000 cursorExhausted:1 numYields:391 nreturned:1 reslen:339 locks:{ Global: { acquireCount: { r: 784 } }, Database: { acquireCount: { r: 392 } }, Collection: { acquireCount: { r: 392 } } } protocol:op_msg 34ms",       "stats" : {         "ms" : 34,         "nReturned" : 1,         "nScanned" : 50000,         "ts" : 1534353251147       }     }, {       "predicates" : [{ "find" : { "emails" : "tocde@fijoow.to" } }],       "raw" : "2018-08-15T17:14:18.665+0000 I COMMAND  [conn4576] command test.users appName: \"MongoDB Shell\" command: find { find: \"users\", filter: { emails: \"tocde@fijoow.to\" }, lsid: { id: UUID(\"1a4e71d3-9b67-4e9c-b078-9fdf3fae9091\") }, $clusterTime: { clusterTime: Timestamp(1534353241, 1), signature: { hash: BinData(0, AB91938B7CF7BC87994A2909A98D87F29101EFA0), keyId: 6589681559618453505 } }, $db: \"test\" } planSummary: COLLSCAN keysExamined:0 docsExamined:50000 cursorExhausted:1 numYields:390 nreturned:1 reslen:342 locks:{ Global: { acquireCount: { r: 782 } }, Database: { acquireCount: { r: 391 } }, Collection: { acquireCount: { r: 391 } } } protocol:op_msg 36ms",       "stats" : {         "ms" : 36,         "nReturned" : 1,         "nScanned" : 50000,         "ts" : 1534353258697       }     } ]   } ],   "suggestedIndexes" : [ {     "id" : "5b74689a80eef53f3388897f",     "impact" : [ "5b74689a80eef53f3388897e" ],     "index" : [ {       "emails" : 1     } ],     "namespace" : "test.users",     "weight" : 37.220480901815623   }, {     "id" : "5b74689a80eef53f33888980",     "impact" : [ "5b74689a80eef53f3388897d" ],     "index" : [ {       "email" : 1     } ],     "namespace" : "test.inventory",     "weight" : 19.037578309966488   } ] }