Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 索引模式值不能为';无';当自动索引指定为';正确';_Azure_Azure Cosmosdb - Fatal编程技术网

Azure 索引模式值不能为';无';当自动索引指定为';正确';

Azure 索引模式值不能为';无';当自动索引指定为';正确';,azure,azure-cosmosdb,Azure,Azure Cosmosdb,删除索引时,尝试插入文档时出现以下错误: {{ "code": "BadRequest", "message": "Message: {\"Errors\":[\"Indexing mode value cannot be 'none' when automatic indexing is specified as 'true'.\"]}..." }} 我正在使用SDK执行以下操作: collection.IndexingPolicy.IndexingMode = IndexingMo

删除索引时,尝试插入文档时出现以下错误:

{{
  "code": "BadRequest",
  "message": "Message: {\"Errors\":[\"Indexing mode value cannot be 'none' when automatic indexing is specified as 'true'.\"]}..."
}}
我正在使用SDK执行以下操作:

collection.IndexingPolicy.IndexingMode = IndexingMode.None;

client.ReplaceDocumentCollectionAsync(collection).Wait();

我在网上找不到有关此错误或将自动索引指定为true/false的任何信息。

文档中似乎缺少此信息

对于
索引模式,需要将自动索引设置为
false
。无

collection.IndexingPolicy.Automatic=false;
collection.IndexingPolicy.IndexingMode=IndexingMode.None;
client.ReplaceDocumentCollectionAsync(collection.Wait();

啊,谢谢。那么,这是完全提供您自己的索引的方法吗?当然,前提是策略设置为惰性或一致。据我所知,默认的自动索引本质上是在每个资源(和子资源)属性上创建一个哈希和范围索引,这在许多情况下是完全多余的。这些设置将完全关闭索引。如果希望应用自定义索引策略,则需要定义自定义路径。默认情况下,索引策略中包含一个通配符路径,
/*
,它可以解释为索引根文档下的每个属性。要完全切换到自定义索引策略,请排除根通配符路径,
/*
,并仅包括您的自定义路径(例如
/prop/subop/?
),您可以在此处找到参考:我似乎无法排除带有
/*
路径的所有路径。我收到以下错误:无法接受索引路径“\\/*”。请确保路径在所有索引路径集上都是唯一的,并且是有效的。我使用的是惰性模式,索引设置为默认值。我为此创建了一个问题。