mongodbazuregoazure-cosmosdb

Azure cosmosDB(mongoDB), how to disable the automatic indexing in a collection in GO lang or via Shell


I tried to delete the DocumentDBDefaultIndex manually through mongo shell and also through my GO code but it still exists. I don't want to have those default indexes lying around which would consume unnecessary space; I actually only need some _id, unique and text indexes.


Solution

  • It seems that mongo wire protocol does not support the feature of indexing policy change. As @DavidMakogon said, please refer to the document How does Azure Cosmos DB index data? to change the settings of indexing policy on Azure portal as the figure below, or using REST API Replace a Collection.

    enter image description here

    Hope it helps.