简体   繁体   English

包含 arrays 的 CosmosDB 索引建议似乎采用不受支持的格式(w/PopulateIndexMetrics)

[英]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.我正在使用 CosmosDB 的 V3 API。我将 PopulateIndexMetrics 设置为 true 以生成索引建议。 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):这是我将 PopulateIndexMetrics 设置为 true 时得到的复合索引建议示例(其中 a 和 c 是简单的字符串属性,b 是字符串数组):

Index Spec: "/a ASC, /b/[] ASC, /c ASC\r\n"索引规范:“/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.但是,当我尝试通过 Azure 门户添加此复合索引时,不支持此数组格式。 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.而且我已经将其添加到索引中:“/a ASC、/b ASC、/c ASC”(我删除了方括号)但是当我重新运行索引推荐器时,它仍然会重新使用不支持的格式重新推荐缺失的索引.

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.我不确定为什么PopulateIndexMetrics会提出这样的建议,但复合索引只能包含标量值。

Composite paths lead to a scalar value that is the only value included in the composite index.复合路径导致一个标量值,该值是复合索引中包含的唯一值。

As found in the Microsoft DocsMicrosoft Docs中所见

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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