azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

[FEATURE REQ] @CosmosIndexingPolicy annotation does not apply changes to the index policy

Open Blackbaud-EricSlater opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. Once you specify an index policy using @CosmosIndexingPolicy it is effectively permanent unless you change it through some other means not using the SDK (using the azure portal for instance). This is not ideal since most production applications do not allow access to production databases via the portal. Also, if some other mechanism is used to change indexing policy then the annotation will no longer accurately describe the policy unless developers change it to match, but at that point the annotation is acting more as documentation than code that actually does something.

It seems like this is the case because the indexing policy is applied when the collection is created. So, any subsequents edits to the policy annotation are ignored once the collection is made. The spring-data-cosmos lib needs to provide users the means to change a collections indexing policy either by respecting changes the user makes to @CosmosIndexingPolicy annotation or some other mechanism that applies an index transformation.

Describe the solution you'd like Ideally, changes to the @CosmosIndexingPolicy annotation should apply the necessary index transformations on application startup. Its unclear what the cost of index transformations are and how long it would take, particularly in the event when the collection has a lot of documents in it. If it is the case that index transformations are a long running operation then applying them on app startup may not be ideal and some other out of band mechanism may be necessary.

Describe alternatives you've considered The spring-data-cosmos lib does not support this at all as far as I can tell. I have not tried to make index changes using the underlying azure-cosmos lib but maybe there is support there.

Additional context Add any other context or screenshots about the feature request here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [x] Description Added
  • [x] Expected solution specified

Blackbaud-EricSlater avatar Nov 12 '20 20:11 Blackbaud-EricSlater

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kushagraThapar, @anfeldma-ms

ghost avatar Nov 12 '20 20:11 ghost

@mbhaskar - please take a look at this.

kushagraThapar avatar Nov 13 '20 03:11 kushagraThapar

This has been implemented. Closing this issue.

kushagraThapar avatar Dec 20 '22 16:12 kushagraThapar