googleapis / googleapis/google-cloud-python

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

Abierto
#16,710 1 comentario 0 reacciones 0 asignados Ver en GitHub
priority: p3 type: question
Lenguaje dominante
Python
Estrellas
5.4k
Forks
1.8k
Merge medio
3 d 4 h
PR fusionados (30 d)
122

Descripción

### 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_

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.