考虑以下json响应。
如果您运行图形查询g.V().hasLabel('customer')
,则响应为:
[
{
"id": "75b9bddc-4008-43d7-a24c-8b138735a36a",
"label": "customer",
"type": "vertex",
"properties": {
"partitionKey": [
{
"id": "75b9bddc-4008-43d7-a24c-8b138735a36a|partitionKey",
"value": 1
}
]
}
}
]
如果运行sql查询select * from c where c.label = 'customer'
,则响应为:
[
{
"label": "customer",
"partitionKey": 1,
"id": "75b9bddc-4008-43d7-a24c-8b138735a36a",
"_rid": "0osWAOso6VYBAAAAAAAAAA==",
"_self": "dbs/0osWAA==/colls/0osWAOso6VY=/docs/0osWAOso6VYBAAAAAAAAAA==/",
"_etag": "\"2400985f-0000-0c00-0000-5e2066190000\"",
"_attachments": "attachments/",
"_ts": 1579181593
}
]
问:鉴于partitionKey
部分的结构存在差异,在索引策略中应将其引用为/properties/partitionKey/*
还是/partitionKey/?
?>
目前我已经被...押注了。
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [{
"path": "/properties/partitionKey/*"
},{
"path": "/partitionKey/?"
},{
"path": "/label/?"
}
],
"excludedPaths": [{
"path": "/*"
},{
"path": "/\"_etag\"/?"
}
]
}
TIA! ?
答案 0 :(得分:0)
这应该在索引策略中存储为“ / partitionKey”,而不是“ / properties / partitionKey”
顺便说一句,这里要指出的另一件事是,通常最好只排除您永远不会查询的路径,而不必包括您将要查询的路径。这样,如果您向图形添加属性,则无需重建索引即可查询新属性。