英文:
Index setting path in Cosmos DB
问题
"includedPaths": [
{
"path": "/PartitionKey/*"
}
]
如果我将Path
仅更改为"/PartitionKey"
,那会有什么不同?
<details>
<summary>英文:</summary>
In Cosmos DB, I have an index setting that looks like this:
```json
"includedPaths": [
{
"path": "/PartitionKey/*"
}
]
What would be the difference if I changed the Path
to only this: "/PartitionKey"?
答案1
得分: 2
这意味着在文档中嵌套节点上将不会启用索引。任何位于 /PartitionKey/ 下的内容。如果您计划查询此路径的属性的子属性,则应使用字符 *。
来自文档,
> /* 通配符可用于匹配节点下面的任何元素
如果您没有嵌套节点,那么这就足够了。此外,您需要在索引路径的末尾使用 ?
字符,以便为查询提供服务,这些查询会在此属性上进行查询。
/PartitionKey/?
英文:
That means indexing won't be enabled on the nested nodes in the document. The path to anything under /PartitionKey/. The character * should be used if you are planing to query on sub properties of the property for this path.
from the documentation,
> the /* wildcard can be used to match any elements below the node
If you don't have nested nodes then this should be good enough. Also you need to use the ?
character at the end of the index path is required to serve queries that query on this property.
/PartitionKey/?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论