azure - DocumentDB - 无法比较查询中的两个路径

标签 azure azure-cosmosdb

Microsoft Azure 文档 BadRequestException 使用针对未范围索引的路径的筛选器指定了无效查询。考虑在请求中添加允许扫描 header 。

我的查询是:

SELECT c.id FROM users c WHERE (c.lat < 29.89)

结束了?文档数量(因为 DocumentDB 无法获取集合中的文档数量)

最佳答案

如果您查看此处的博文: http://azure.microsoft.com/blog/2015/01/27/performance-tips-for-azure-documentdb-part-2/

Indexing Policy Tip #3: Specify range index path type for all paths used in range queries

DocumentDB currently supports two index path types: Hash and Range. Choosing an index path type of Hash enables efficient equality queries. Choosing an index type of Range enables range queries (using >, <, >=, <=).

它给出了 C# 中添加范围索引以使路径具有可比性的示例,但 node.js library. 中也有类似的功能。

创建集合时,可以通过body参数传递IndexingPolicy。 IndexingPolicy有几个成员。其中之一是 IncludedPaths,您可以在其中定义索引。

var policy = { 
   Automatic: true,
   IndexingMode: 'Lazy',
   IncludedPaths: [
      {
      IndexType: "Range",
      Path: "path to be indexed (c.lat)",
      NempericPrecission: "1",
      StringPrecission: "1"
      }
   ],
   ExcludedPaths: []
}

client.createCollection(
  '#yourdblink', 
  { 
    id: 10001, 
    indexingPolicy: policy 
  });

关于azure - DocumentDB - 无法比较查询中的两个路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28418772/

相关文章:

java - 使用 azure.keyvault.secret.property-sources 时 Spring Boot 应用程序启动失败并丢失日志

azure - 是否可以在 Azure 警报中显示 KQL 查询结果?

azure - 无法使用 azure JavaScript 函数和 Key Vault key 检索 cosmosDB 数据

azure - 由于 azure 网站无法将 IP 地址解析为网站,因此无法进行 A 记录重定向

azure - CloudBlobClient.startCopyAsync() 的源代码

azure - 收集标准属性的列表。和扩展属性。对于 Azure

Azure 流分析 CreateOrReplace 转换冲突或错误请求

azure - 对于Azure DocumentDB输入绑定(bind),有没有办法从标题中获取文档ID?

azure - 如何获取在 Azure Cosmos DB 中执行存储过程时消耗的 RU 数量?

azure - 更新所有文档的 ttl