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.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Mark Brown - MSFT 2,771 Reputation points Microsoft Employee Moderator
    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.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.