Proper interpretation of Azure Advisor's recommendation 'Add missing indexes to your Azure Cosmos DB container'

Vladimir Nedoroslev 0 Reputation points
2025-04-24T07:56:42.8266667+00:00

Hello,

I have an Azure Cosmos Db set up. Recently I've got an Azure Advisor's recommendation to add some indexes to the database:

Add missing indexes to your Azure Cosmos DB container

Potential Indexes - "/someField1 ASC","/someField2 ASC","/someField3 ASC ","/someField4 ASC","/someField5 ASC"

My current indexing policy is default which covers all the fields:

{ 
	"includedPaths": [
        {
            "path": "/*"
        }
    ]
}

By following the recommendation am I supposed to add the following single composite index?:

{
  "compositeIndexes": [
    [
      {
        "path": "/someField1",
        "order": "ascending"
      },
      {
        "path": "/someField2",
        "order": "ascending"
      },
      {
        "path": "/someField3",
        "order": "ascending"
      },
      {
        "path": "/someField4",
        "order": "ascending"
      },
      {
        "path": "/someField5",
        "order": "ascending"
      }
    ]
  ]
}

I've tried adding that composite index but the recommendation did not go away and my query performance got worse because the planner started using that composite index instead of the multiple single indexes (as the query planner showed).

Am I missing something here? Just wanted to be sure I'm interpreting the recommendation correctly and can rely on Azure Advisor's recommendation.

With best regards,

Vladimir

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,471 questions
0 comments No comments
{count} votes

Your answer

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