# WhereFilter Not Working In Deleting Records

**URL:** <https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623>\
**Category:** Support\
**Created:** [June 5, 2024, 1:00pm UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623 "2024-06-05T13:00:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiratkumar47](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kiratkumar47](https://forum.weaviate.io/u/kiratkumar47)\
**Post date:** [June 5, 2024, 1:00pm UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623/1 "2024-06-05T13:00:17Z")

</div>

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:

```auto
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:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/weaviate/original/2X/a/a59caa0cd848c93fda82aa4e236967299ad0b080.png)

Any assistance would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![antas-marcin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/antas-marcin/32/20_2.png) [@antas-marcin](https://forum.weaviate.io/u/antas-marcin)\
**Post date:** [June 7, 2024, 6:18pm UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623/2 "2024-06-07T18:18:45Z")

</div>

Hello, you want to delete from your `objectClass` class an object with `id` that `equals` `1`?

---

<div class="post-metadata">

**Author:** ![kiratkumar47](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kiratkumar47](https://forum.weaviate.io/u/kiratkumar47)\
**Post date:** [June 7, 2024, 6:30pm UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623/3 "2024-06-07T18:30:58Z")

</div>

Hello,  
Yes I want to delete object which has id =1 in \_metadata.

---

<div class="post-metadata">

**Author:** ![antas-marcin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/antas-marcin/32/20_2.png) [@antas-marcin](https://forum.weaviate.io/u/antas-marcin)\
**Post date:** [June 7, 2024, 7:24pm UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623/4 "2024-06-07T19:24:33Z")

</div>

and what is the name of your class?

---

<div class="post-metadata">

**Author:** ![kiratkumar47](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kiratkumar47](https://forum.weaviate.io/u/kiratkumar47)\
**Post date:** [June 8, 2024, 10:12am UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623/5 "2024-06-08T10:12:32Z")

</div>

Test53f3c87a4585ae838abcefcc4e5b

---

<div class="post-metadata">

**Author:** ![kiratkumar47](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kiratkumar47](https://forum.weaviate.io/u/kiratkumar47)\
**Post date:** [June 8, 2024, 10:13am UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623/6 "2024-06-08T10:13:07Z")

</div>

You can see complete code in following pull request.

> <https://github.com/langchain4j/langchain4j/pull/1196>
>
> \## 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)

---

<div class="post-metadata">

**Author:** ![antas-marcin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/antas-marcin/32/20_2.png) [@antas-marcin](https://forum.weaviate.io/u/antas-marcin)\
**Post date:** [June 10, 2024, 8:15am UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623/7 "2024-06-10T08:15:59Z")

</div>

a proper syntax for reaching into reference properties is:

```auto
.path("<CROSS_REFERENCE_NAME>", "<REF_CLASS_NAME>", "<PROPERTY_OF_REF_CLASS>")

```

so in your case in should be something like that:

```auto
.path("_metadata", "<REF_CLASS_NAME>", "id")

```

---

<div class="post-metadata">

**Author:** ![kiratkumar47](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kiratkumar47](https://forum.weaviate.io/u/kiratkumar47)\
**Post date:** [June 10, 2024, 9:27am UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623/8 "2024-06-10T09:27:17Z")

</div>

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:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/weaviate/original/2X/0/019c59bdd05a12a5f89b912f895b6a782cc1c6a3.png)  
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

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [June 10, 2024, 9:00pm UTC](https://forum.weaviate.io/t/wherefilter-not-working-in-deleting-records/2623/9 "2024-06-10T21:00:01Z")

</div>

hi @kiratkumar47 !!

There are only some [configurations in a collection that are mutable](https://weaviate.io/developers/weaviate/config-refs/schema#mutability).

This is not one of them 🙈

> **[Collection schema | Weaviate - Vector Database](https://weaviate.io/developers/weaviate/config-refs/schema#indexfilterable-and-indexsearchable)**
>
> Introduction

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!
