Cosmos重新编制索引所需的时间比预期的长。 有什么办法可以检查分区集合是否仍在进行重新索引。 即使我将索引策略设置为无并保持一致,查询仍会引发错误。
答案 0 :(得分:0)
您可以通过阅读GET集合中的x-ms-documentdb-collection-index-transformation-progress
标头查看进度百分比。例如,在.NET中,您可以运行以下代码段:
// retrieve the container's details
ContainerResponse containerResponse = await client.GetContainer("database", "container")
.ReadContainerAsync(new ContainerRequestOptions { PopulateQuotaInfo = true });
// retrieve the index transformation progress from the result
long indexTransformationProgress = long.Parse(
containerResponse.Headers["x-ms-documentdb-collection-index-transformation-progress"]);