在Cosmos DB graph中,当我将索引策略定义为自动时,我能够运行查询,但当我将索引策略更新为手动并定义索引路径时(/label/?)如果索引模式设置为“一致”,则查询不会获取任何数据。
假设我的第一个查询(当索引策略设置为手动时)是:
g.addV('Azure').property('name','Cerulean Software'))
结果是:
[
{
"id": "0c14a00a-edf6-46b1-9e40-45cc37f750ea",
"label": "Azure",
"type": "vertex",
"properties": {
"name": [
{
"id": "f89ee2ee-74df-4256-a5d4-2b47eb526976",
"value": "Cerulean Software"
}
]
}
}
]
现在,我的第二个查询(当索引策略设置为手动时(请参见下面的编辑#1))是:
g.V().hasLabel('Azure')
即使在名为“Azure”的图中存在顶点,第二个查询也不会获取任何结果。
这背后可能的原因是什么?
编辑#1:更改前手动索引策略
"indexingPolicy": {
"automatic": false,
"excludedPaths": [],
"includedPaths": [
{
"path": "/*",
"indexes": [
{
"dataType": "Number",
"kind": "Range",
"precision": -1
},
{
"dataType": "String",
"kind": "Hash",
"precision": 3
}
]
},
{
"path": "/label/?",
"indexes": [
{
"dataType": "String",
"kind": "Hash",
"precision": 3
},
{
"dataType": "Number",
"kind": "Range",
"precision": -1
}
]
}
],
"indexingMode": "consistent"
},
编辑#2:更改后的手动索引策略
"indexingPolicy": {
"automatic": false,
"excludedPaths": [],
"includedPaths": [
{
"path": "/*",
"indexes": [
{
"dataType": "Number",
"kind": "Range",
"precision": -1
},
{
"dataType": "String",
"kind": "Hash",
"precision": 3
}
]
},
{
"path": "/_isEdge/?",
"indexes": [
{
"dataType": "String",
"kind": "Hash",
"precision": 3
},
{
"dataType": "Number",
"kind": "Range",
"precision": -1
}
]
}
],
"indexingMode": "consistent"
},