简体   繁体   中英

CosmosDB's index recommendations that include arrays seem to be in an unsupported format (w/ PopulateIndexMetrics)

I'm using CosmosDB's V3 API. I set PopulateIndexMetrics to true to generate index recommendations. However, some of the recommendations (relating to arrays) seem to be in an unsupported format and when I try and add them as is (to my containers' indexes) the operation fails.

Here is an example composite index recommendation which I get when I set PopulateIndexMetrics to true (where a and c are simple string properties and b is an array of strings):

Index Spec: "/a ASC, /b/[] ASC, /c ASC\r\n"

However, this array format isn't supported when I try and add this composite index via the Azure Portal. And I've already added this to the index: "/a ASC, /b ASC, /c ASC" (I removed the square parantheses) yet when I rerun the index recommender it still re-recommends the missing index with the unsupported format.

Any help would be appreciated.

Thanks!

I'm unsure why PopulateIndexMetrics would make such a suggestion, but a composite index can only include scalar values.

Composite paths lead to a scalar value that is the only value included in the composite index.

As found in the Microsoft Docs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM