I am trying to delete a Weaviate object using WhereFilter
in Java, but it is not deleting the object.
Below is the code for deleting the object:
client.batch().objectsBatchDeleter()
.withClassName(objectClass)
.withWhere(WhereFilter.builder()
.path("_metadata", "id")
.operator(Operator.Equal)
.valueString("1")
.build())
.run();
The following screenshot shows the Weaviate object that I am trying to delete:
Any assistance would be greatly appreciated.
Hello, you want to delete from your objectClass
class an object with id
that equals
1
?
Hello,
Yes I want to delete object which has id =1 in _metadata.
and what is the name of your class?
Test53f3c87a4585ae838abcefcc4e5b
You can see complete code in following pull request.
langchain4j:main
← kiratkumar47:feat-Implement-embedding-removal-methods-for-Weaviate-embedding-store
opened 12:16PM - 29 May 24 UTC
## Issue
fix #1171
## Change
Implemented EmbeddingStore removal method (… remove(String id), removeAll(Collection<String> ids)) and removeAll()) in WeaviateEmbeddingStore.
## General checklist
- [X] There are no breaking changes
- [ ] I have added unit and integration tests for my change
- [ ] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the [core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core) and [main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j) modules, and they are all green
- [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features)
a proper syntax for reaching into reference properties is:
.path("<CROSS_REFERENCE_NAME>", "<REF_CLASS_NAME>", "<PROPERTY_OF_REF_CLASS>")
so in your case in should be something like that:
.path("_metadata", "<REF_CLASS_NAME>", "id")
Hi @antas-marcin ,
Thank you for the answer, but it is not working.
I have created a free weaviate cloud cluster and here is what I see:
It seems that metadata field (and its subfields) should be filterable for the test to work. Could you please tell me how to enable it using code. I couldn’t find any documentation on it
hi @kiratkumar47 !!
There are only some configurations in a collection that are mutable .
This is not one of them
So on that case, you can create a new collection with the proper configuration, and insert or migrate your data over.
Let me know if this helps!
Thanks!