PlagueHO / CosmosDB

PowerShell Module for working with Azure Cosmos DB databases, collections, documents, attachments, offers, users, permissions, triggers, stored procedures and user defined functions.
http://dscottraynsford.com
MIT License
154 stars 46 forks source link

Configure composite index with New-CosmosDbCollectionIndexingPolicy #357

Closed 4ybaka closed 4 years ago

4ybaka commented 4 years ago

How can I specify composite index with New-CosmosDbCollectionIndexingPolicy? I see no such parameter in cmdlet.

PlagueHO commented 4 years ago

Hi @4ybaka - this is something I haven't added support for, but it is fairly straight forward for me to add. I'll aim to implement this over the weekend.

I'll need to add a couple more cmdlets that allow them to be created: https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-indexing-policy#composite-index-defined-for-name-asc-age-asc-and-name-asc-age-desc

PlagueHO commented 4 years ago

Starting work on this now.

PlagueHO commented 4 years ago

I've completed the work on this now. I had to update the module to use the 2018-09-17 version of the REST APIs, which was the first version that supported composite indexes. This resulted in a change in how index policies are applied to collections, so I've made this a BREAKING CHANGE, which will result in a new major version being released.

I'm going to make one further change to allow indexes to be set via JSON as well as an object, so that if there are any specific index patterns that aren't supported by this module then you can still manually set them.

Expect this to be released to PS Gallery later on today.

PlagueHO commented 4 years ago

Hi @4ybaka - this has been released in v4.0.0 - https://www.powershellgallery.com/packages/CosmosDB/4.0.0

4ybaka commented 4 years ago

Great! Thanks a lot.