You can call this operation to query the index recommendation details of an AsparaDB for MongoDB instance.

Note This operation is unavailable now.

Ensure that the instance meets the following conditions when you call this operation:

  • The region of the instance is China (Hangzhou), China (Shanghai), China (Shenzhen), China (Qingdao), or China (Beijing).
  • The instance is a replica set instance or a sharded cluster instance.
  • The audit log feature is enabled for the instance.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeIndexRecommendation

The operation that you want to perform. Set the value to DescribeIndexRecommendation.

InstanceId String Yes dds-bpxxxxxxxx

The ID of the instance.

RegionId String Yes cn-hangzhou

The ID of the region where the instance is deployed. You can call the DescribeDBInstanceAttribute operation to query the region ID.

TaskId String No 3223069

The ID of the task. You can call the DescribeAvailableTimeRange operation to query task IDs.

NodeId String No d-bpxxxxxxxx

The ID of the mongos or shard in the specified sharded cluster instance.

Note This parameter is valid only if you set the InstanceId parameter to the ID of a sharded cluster instance.
Database String No mongodbtest

The name of the database.

Collection String No customer

The name of the collection.

StartTime String No 2019-01-01T12Z

The beginning of the time range to query. Specify the time in the YYYY-MM-DDTHHZ format. The time must be in UTC.

Note The value of the StartTime parameter must be later than the time when the audit log feature is enabled.
EndTime String No 2019-01-02T13Z

The end of the time range to query. The end time must be later than the start time. Specify the time in the YYYY-MM-DDTHHZ format. The time must be in UTC.

OperationType String No query

The type of operation to perform, such as query, delete, and update.

PageSize Integer No 30

The number of entries to return on each page. Valid values: 30, 50, and 100. Default value: 30.

PageNumber Integer No 1

The number of the page to return. The value must be a positive integer. Default value: 1.

Response parameters

Parameter Type Example Description
Analyzations Array

Details about the index recommendation.

AverageDocsExaminedCount Long 1000000

The average number of times each document was scanned.

AverageExecutionTime Long 523

The average execution time. Unit: milliseconds.

AverageKeysExaminedCount Long 0

The average number of times the index was examined.

AverageReturnRowCount Long 1

The average number of entries returned.

Count Long 364

The number of times the query was performed.

Database String mongodbtest

The name of the database.

ExecutionPlan String {\"stage\":\"COLLSCAN\"}

The execution plan of the query.

InMemorySort String false

Indicates whether in-memory sorting was performed.

IndexCombines List {"IndexCombine": ["db.customer.createIndex({\"name\": 1}, {background: true})"]}

The merged indexes.

IndexRecommendations Array

The index recommendations.

Content String db.customer.createIndex({\"name\": 1}, {background: true})

The content of the recommendation.

RecmdType String Index

The returned recommendation.

  • Index: Optimize the index direction.
  • Refactor: No indexes are applied to the query. Rewrite the query.
  • WhereUse: The query includes the WHERE clause, which cannot be used with indexes. Do not include the WHERE clause in index queries.
  • NoRecommendation: No recommendations.
LastExecutionTime String 2019-03-22T05:52:31Z

The most recent execution time. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Namespace String mongodbtest.customer

The namespace.

Note The namespace is typically a combination of the database name and the collection name.
Operation String query

The type of the operation performed.

Query String {\"name\":\"<val>\"}

The query command.

Sort String {}

The sorting command.

TotalExecutionTime Long 191569

The amount of time taken to execute the operation, in milliseconds.

RequestId String 553CCFB2-C013-4A9D-86A9-F440BA7E365F

The ID of the request.


Sample requests

http(s):// Action=DescribeIndexRecommendation
&<Common request parameters>

Sample success responses

XML format

                    <Content>db.customer.createIndex({"name": 1}, {background: true})</Content>
                <IndexCombine>db.customer.createIndex({"name": 1}, {background: true})</IndexCombine>

JSON format

                            "Content":"db.customer.createIndex({\"name\": 1}, {background: true})"
                        "db.customer.createIndex({\"name\": 1}, {background: true})"

Error codes

HttpCode Error code Error message Description
400 InvalidEndTime.Format Specified end time is not valid. The error message returned because the end of the time range to query is invalid. Check the format of the specified time.

For a list of error codes, visit the API Error Center.