googleapis / googleapis/google-cloud-python

Deleting a collection in vector search version 2 with objects is not possible

Ouverte
#16,710 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
priority: p3 type: question
Langage dominant
Python
Étoiles
5.4k
Forks
1.8k
Merge moyen
2 j 23 h
PR mergées (30 j)
123

Description

### Determine this is the right repository

- [x] I determined this is the correct repository in which to report this bug.

### Summary of the issue

When running the quickstart example of vector search version 2 colab https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/embeddings/vector-search-quickstart.ipynb
a collection is created.

The notebooks falsely prints at the end that this collection is deleted, like this
`# Delete the Collection (and all Data Objects inside it)
request = vectorsearch_v1beta.DeleteCollectionRequest(
name=f"projects/{PROJECT_ID}/locations/{LOCATION}/collections/{collection_id}"
)
vector_search_service_client.delete_collection(request)
print(f"🗑️ Deleted Collection: {collection_id}")
print(" All Data Objects in the Collection have been deleted as well.")
print("\n✅ Cleanup complete! All Vector Search 2.0 resources have been deleted.")`

It never looks the actual result up, like in the doc
https://docs.cloud.google.com/vertex-ai/docs/vector-search-2/collections/collections#deleting_a_collection
`operation.result()`

When running for the result, one can see that the collection is not deleted, the request fails with
`FailedPrecondition: 400 Invalid resource state for "projects/xxx": Collection deletion is not allowed because it still has data objects. 9: Invalid resource state for "projects/xxx": Collection deletion is not allowed because it still has data objects.`
, which is not documented behaviour, the notebook even says this cmd should delete all objects in the collection.

Current doc for deleting objects [doc](https://docs.cloud.google.com/vertex-ai/docs/vector-search-2/data-objects/data-objects#delete_data_objects) is not documenting how do batch delete all points.

The api auto doc does not name any forcing parameters for delete collection request [doc](https://docs.cloud.google.com/python/docs/reference/google-cloud-vectorsearch/latest/google.cloud.vectorsearch_v1beta.services.vector_search_service.VectorSearchServiceClient#google_cloud_vectorsearch_v1beta_services_vector_search_service_VectorSearchServiceClient_delete_collection) .

The api auto doc for batch delete objects [doc](https://docs.cloud.google.com/python/docs/reference/google-cloud-vectorsearch/latest/google.cloud.vectorsearch_v1beta.services.data_object_service.DataObjectServiceClient#google_cloud_vectorsearch_v1beta_services_data_object_service_DataObjectServiceClient_batch_delete_data_objects) does not describe the [request object ](https://docs.cloud.google.com/python/docs/reference/google-cloud-vectorsearch/latest/google.cloud.vectorsearch_v1beta.types.DeleteDataObjectRequest.html), but it looks impossible to delete all at once: “A maximum of 1000 DataObjects can be deleted in a batch.”. This suggests that one has to collect all ids first and delete in many batches….

The link to github issues in the notebook goes to nowhere https://github.com/googleapis/python-vector-search/issues

How to delete a collection with objects?

### API client name and version

google-cloud-vectorsearch >= 0.7.0 , <= 0.9.0

### Reproduction steps: code

run the quickstart example of vector search version 2 colab https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/embeddings/vector-search-quickstart.ipynb
to the end.

Modify the step where the collection is deleted to actually look the result of the operation up, like https://docs.cloud.google.com/vertex-ai/docs/vector-search-2/collections/collections#deleting_a_collection

### Reproduction steps: supporting files

_No response_

### Reproduction steps: actual results

FailedPrecondition: 400 Invalid resource state for "projects/xxx": Collection deletion is not allowed because it still has data objects. 9: Invalid resource state for "projects/xxx": Collection deletion is not allowed because it still has data objects.

### Reproduction steps: expected results

200 success

### OS & version + platform

_No response_

### Python environment

_No response_

### Python dependencies

_No response_

### Additional context

_No response_

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par embeddings/vector-search-quickstart.ipynb et exécutez sa séquence de nettoyage jusqu’à la suppression de la collection. Vérifiez l’opération de suppression avec operation.result(), puis comparez le notebook avec la documentation sur la suppression des collections et des objets de données, notamment les limites des requêtes de suppression par lots. Le travail est terminé lorsque le comportement du nettoyage et le signalement de la réussite sont exacts, et que le chemin de suppression documenté est clair.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
google-cloud, jupyter-notebook, python
Domaine
cloud, documentation
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
52/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.