对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。

获取索引删除建议

检索性能Performance Advisor确定的索引删除建议。

基本 URL: https://cloud.mongodb.com/api/public/v1.0

GET /groups/{PROJECT-ID}/performanceAdvisor/dropIndexSuggestions
Parameter
类型
说明

PROJECT-ID

字符串

(必需)拥有此MongoDB 部署的项目的唯一标识符。群组和项目是同义词。您的群组 ID(group ID)与您的项目ID相同。

需要 clusterId 或 hostId。

Parameter
类型
说明

pretty

布尔

指示显示正文是否应采用 prettyprint 格式。

envelope

布尔

指示是否要将响应封装在信封中。

clusterId

字符串

副本集或分片集群的唯一标识符。如果您希望使用 hostId 为独立运行实例提供索引删除建议,请将此参数设置为 null。

hostId

字符串

您想要提供索引删除建议的独立运行实例的唯一标识符。如果 clusterId 为 null,则为必填项。

此端点不使用 HTTP 请求正文参数。

名称
类型
说明

unusedIndexes

文档数组

有关被视为删除候选索引的未使用索引的信息。

hiddenIndexes

文档数组

有关待删除索引的信息。

redundantIndexes

文档数组

有关可能与现有索引重叠并考虑删除的冗余索引的信息。

curl --user '{PUBLIC-KEY}:{PRIVATE-KEY}' --digest \ --header 'Accept: application/json' \ --include \ --request GET 'https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/performanceAdvisor/dropIndexSuggestions?clusterId={clusterId}&pretty=true'
{ "hiddenIndexes": [ { "shardIds": ["shard-0"], "accessCount": 0, "index": [ { "_fts": "text" }, { "_ftsx": 1 } ], "name": "product_description_reviews_text", "namespace": "inventory.products", "since": "2024-10-02T18:02:22Z", "sizeBytes": 4096 }, { "shardIds": ["shard-0"], "accessCount": 0, "index": [ { "unseenFeature": 1 } ], "name": "unseenFeature_1", "namespace": "inventory.products", "since": "2024-10-02T18:02:22Z", "sizeBytes": 4096 } ], "redundantIndexes": [ { "shardIds": ["shard-0"], "accessCount": 0, "index": [ { "category": 1 } ], "name": "category_1", "namespace": "inventory.products", "relatedIndexes": [ { "accessCount": 1, "index": [ { "category": 1 }, { "price": -1 } ], "name": "category_1_price_-1", "namespace": "inventory.products", "since": "2024-10-02T18:02:22Z", "sizeBytes": 4096 } ], "since": "2024-10-02T18:02:22Z", "sizeBytes": 4096 } ], "unusedIndexes": []}