[CSHARP-4864] Unable to create Vector search index via MongoDB driver Created: 08/Dec/23 Updated: 12/Dec/23 Resolved: 12/Dec/23 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Builders |
| Affects Version/s: | 2.22.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Unknown |
| Reporter: | VenkateshSrini N/A | Assignee: | Boris Dogadov |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
| Description |
|
Hi, I would like to perform a vector cosine similarity in mongo DB. For that as a first step I need to create an index similar to below {{{}} I want to do the same via MongoDB C# drivers. This is because I create the collection dynamically via code. I tried using the CreateIndexModelOptions. This class does not seem to have the properties required to create the above index. How do I go about doing this ?
{{ }}}
|
| Comments |
| Comment by Boris Dogadov [ 12/Dec/23 ] | |||||||||||||||||||||||||||||||||
|
Thanks for the update venkateshsrini3@gmail.com | |||||||||||||||||||||||||||||||||
| Comment by VenkateshSrini N/A [ 12/Dec/23 ] | |||||||||||||||||||||||||||||||||
|
Thanks. You can consider the issue as closed. | |||||||||||||||||||||||||||||||||
| Comment by Boris Dogadov [ 11/Dec/23 ] | |||||||||||||||||||||||||||||||||
|
The Vector Search tutorial https://www.mongodb.com/products/platform/atlas-vector-search that you've mentioned is a great resource of all information needed to setup the indexes. If you discover that something is not working as expected in C# driver, please file a Jira ticket including steps to reproduce or self contained reproduction code. | |||||||||||||||||||||||||||||||||
| Comment by VenkateshSrini N/A [ 09/Dec/23 ] | |||||||||||||||||||||||||||||||||
|
Thanks for the input. As stated above I wanted to do a create a KNN vector for vector search as described in the link How to Index Vector Embeddings for Vector Search — MongoDB Atlas. The below is the code that I have come up. Document structure
Code for creating index is
Can you please confirm if this is correct? Since I'm doing it the first time need your guidance please | |||||||||||||||||||||||||||||||||
| Comment by Boris Dogadov [ 09/Dec/23 ] | |||||||||||||||||||||||||||||||||
|
Hello venkateshsrini3@gmail.com Please see the tutorial for creating search indexes with MongoDB C# Driver: https://www.mongodb.com/docs/atlas/atlas-search/tutorial/create-index/#programatically You would need to use collection.SearchIndexes.CreateOne(CreateSearchIndexModel) instead of collection.Indexes.CreateOne(CreateIndexModelOptions). | |||||||||||||||||||||||||||||||||
| Comment by PM Bot [ 08/Dec/23 ] | |||||||||||||||||||||||||||||||||
|
Hi venkateshsrini3@gmail.com, thank you for reporting this issue! The team will look into it and get back to you soon. |