我想在 Azure Cosmos DB 文档中的嵌套字段上创建索引。例如。如果我有以下架构:
{
'id': 1,
'nested':
{
'mode': 'mode1',
'text': 'nice text'
}
}
我想在该字段上创建索引nested.mode
。如何才能做到这一点?
Answer recommended by
Microsoft Azure /collectives/azure
Collective
默认情况下,所有路径都在 Cosmos DB 中编制索引。要仅对“nested.mode”建立索引,您需要在/nested/mode/?
具有适当数据类型/精度的路径。 JSON 中类似这样的东西includedPaths
部分。
"path":"/nested/mode/?",
"indexes":[
{
"kind":"Range",
"dataType":"String",
"precision":-1
}
更多详细信息请参见此处:https://learn.microsoft.com/en-us/azure/cosmos-db/indexing-policies https://learn.microsoft.com/en-us/azure/cosmos-db/indexing-policies.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)