gpt4 book ai didi

azure - 为什么 "path": "/\"_etag\"/?" is excluded from the excluded path in indexing policy of cosmosDB

转载 作者:行者123 更新时间:2023-12-03 06:50:45 25 4
gpt4 key购买 nike

我正在使用 powershell 更新索引策略,但它默认在排除路径中添加 "path": "/\"_etag\"/?" 属性我希望索引策略是

{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [],
"excludedPaths": [
{
"path": "/*"
},
]
}

我使用的脚本

$indexPathExcluded = "/*"

$indexingPolicy = New-AzCosmosDBSqlIndexingPolicy -ExcludedPath $indexPathExcluded -IndexingMode Consistent -Automatic $true

update-AzCosmosDBSqlContainer -ResourceGroupName myresourcename -AccountName myaccountname -DatabaseName mydatabasename -Name myCollectionname -IndexingPolicy $indexingPolicy

但是这样我得到的结果是

{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [],
"excludedPaths": [
{
"path": "/*"
},
{
"path": "/\"_etag\"/?"
}
]
}

最佳答案

默认情况下,etag 会从索引策略中排除,作为服务的一项优化,以减少索引和在查询中使用的属性的 RU 消耗有限或没有用处。

etag 是一个内部系统属性,用于 optimistic concurrency control 。 etag 由服务在最初插入项目时生成,然后在每次更新时更新。您可以查看sample for how to use OCC here .

作为用于 OCC 的内部属性,此属性不会添加索引和在查询中使用的值。 OCC 检查不使用索引。而且由于每次更新时值都会发生变化,因此包含在索引策略中会不必要地消耗额外的吞吐量 (RU/s),因为每次都会对值重新建立索引。

关于azure - 为什么 "path": "/\"_etag\"/?" is excluded from the excluded path in indexing policy of cosmosDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73698762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com