0

Consider the following json responses..

If you run the graph query g.V().hasLabel('customer'), the response is:

[
  {
    "id": "75b9bddc-4008-43d7-a24c-8b138735a36a",
    "label": "customer",
    "type": "vertex",
    "properties": {
      "partitionKey": [
        {
          "id": "75b9bddc-4008-43d7-a24c-8b138735a36a|partitionKey",
          "value": 1
        }
      ]
    }
  }
]

If you run the sql query select * from c where c.label = 'customer', the response is:

[
    {
        "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
    }
]

Q: With this difference in structure around the partitionKey section, should this be referenced as /properties/partitionKey/*, or /partitionKey/? in the indexing policy?

Currently i have hedged by bets with...

{
    "indexingMode": "consistent",
    "automatic": true,
    "includedPaths": [{
            "path": "/properties/partitionKey/*"
        },{
            "path": "/partitionKey/?"
        },{
            "path": "/label/?"
        }
    ],
    "excludedPaths": [{
            "path": "/*"
        },{
            "path": "/\"_etag\"/?"
        }
    ]
}

TIA!

m1nkeh
  • 1,337
  • 23
  • 45

1 Answers1

0

This should be stored as "/partitionKey" in your index policy, not "/properties/partitionKey"

btw, another thing to point out here is it's generally better to only exclude paths you will never query on rather than have to include those you will. This way, if you add properties to your graph you won't have to rebuild the index to query on the new properties.

Mark Brown
  • 8,113
  • 2
  • 17
  • 21