Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite Index Exception #51

Open
rfphill opened this issue Aug 11, 2022 · 2 comments
Open

Composite Index Exception #51

rfphill opened this issue Aug 11, 2022 · 2 comments

Comments

@rfphill
Copy link

rfphill commented Aug 11, 2022

I get a constant exception: exception thrown: Exception: Microsoft.Azure.Documents.BadRequestException: Message: {"Errors":["The order by query does not have a corresponding composite index that it can be served from."]}

But there doesn't seem to be any way of telling what that composite index needs to be. I added "type" to the partition key because the app would blow up unless it was defined in the container but that doesn't seem to indicated anywhere either.

@imranmomin
Copy link
Owner

can you confirm if the composite indexes are created

Collection<CompositePath> compositeIndexes = new ()
{
new CompositePath { Path = "/name", Order = CompositePathSortOrder.Ascending },
new CompositePath { Path = "/created_on", Order = CompositePathSortOrder.Ascending }
};

@siazon
Copy link

siazon commented Apr 8, 2024

I had the same problem, after adding the following index, it now works

  "compositeIndexes": [
        [
            {
                "path": "/name",
                "order": "ascending"
            },
            {
                "path": "/created_on",
                "order": "ascending"
            }
        ]
    ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants