【发布时间】:2017-04-07 12:27:03
【问题描述】:
我有一个集合,其中文档具有不同类型的属性,例如字符串、数字、日期时间。
我的索引策略如下:
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*",
"indexes": [
{
"kind": "Range",
"dataType": "Number",
"precision": -1
},
{
"kind": "Hash",
"dataType": "String",
"precision": 3
}
]
}
],
"excludedPaths": []
}
现在我想要的是在字符串字段上添加范围类型索引。 所以我编辑了我的索引策略:
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*",
"indexes": [
{
"kind": "Range",
"dataType": "Number",
"precision": -1
},
{
"kind": "Hash",
"dataType": "String",
"precision": 3
},
{
"kind": "Range",
"dataType": "String",
"precision": 20
}
]
}
],
"excludedPaths": []
}
但它没有工作:(
我知道可以在一个字段上添加多种类型的索引。谁能知道该怎么做?
【问题讨论】:
-
it did not work您要进行范围查询还是按顺序查询?你能告诉我们什么不起作用吗? -
我需要按顺序进行排序,这就是我在字符串上添加 Range 类型索引的原因。但是这个甚至没有被天蓝色服务器验证。当我将此作为索引策略提交时,它显示错误。 @FredHan-MSFT
标签: azure azure-cosmosdb