使用Cosmos DB中的TablesDB表,我尝试只对PartitionKey和RowKey进行索引。
下面的CosmosDB索引可以正确编译,但是当我在分区键/行键上运行查询时,我收到了错误消息"An invalid query has specified with filters a a path(s) excluded from index .考虑在请求中添加allow scan header。“
有人知道如何使用只对PartitionKey和RowKey进行索引而不对其他内容进行索引的CosmosDB TablesDB吗?
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/PartitionKey/?",
"indexes": [
{
"kind": "Hash",
"dataType": "String",
"precision": -1
},
{
"kind": "Range",
"dataType": "Number",
"precision": -1
}
]
},
{
"path": "/RowKey/?",
"indexes": [
{
"kind": "Range",
"dataType": "String",
"precision": -1
},
{
"kind": "Range",
"dataType": "Number",
"precision": -1
}
]
}
],
"excludedPaths": [
{
"path": "/*"
}
]
}
发布于 2019-06-21 03:27:02
我们使用几乎相同的索引配置,只是将'?'字符改为'*'。我们的配置如下所示:
{
"indexingMode": "lazy",
"automatic": true,
"includedPaths": [
{
"path": "/PartitionKey/*",
"indexes": [
{
"kind": "Range",
"dataType": "String",
"precision": -1
},
{
"kind": "Range",
"dataType": "Number",
"precision": -1
}
]
},
{
"path": "/RowKey/*",
"indexes": [
{
"kind": "Range",
"dataType": "String",
"precision": -1
},
{
"kind": "Range",
"dataType": "Number",
"precision": -1
}
]
}
],
"excludedPaths": [
{
"path": "/*"
}
]
}
https://stackoverflow.com/questions/53439991
复制相似问题