Composite index on nested field

kevin eckart 26 Reputation points
2020-06-23T21:11:53.85+00:00

I'm having an issue creating a composite index on a nested field in our collection. Is this even possible?

{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*"
}
],
"excludedPaths": [
{
"path": "/\"_etag\"/?"
}
],
"compositeIndexes": [
[
{
"path": "/field1",
"order": "descending"
},
{
"path": "/form_data/field2",
"order": "ascending"
}
]
]
}

when I try to save the policy, I get the following error.

Failed to update container MyContainer: {"code":400,"body":{"code":"BadRequest","message":"Message: {\"Errors\":[\"The indexing path '\/form_data\/field2' could not be accepted, failed near position '16'. Please ensure that the path is a valid path. Common errors include invalid characters or absence of quotes around labels.\"]

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,535 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mark Brown - MSFT 2,766 Reputation points Microsoft Employee
    2020-06-23T23:54:05.943+00:00

    I copy and pasted your index policy into the portal and it worked fine. There's nothing wrong with it. If you continue to get this error you may want to raise a support ticket.

    Thanks.