kestra-io / plugin-weaviate

Apache License 2.0
1 stars 3 forks source link

Cannot delete objects by filter #13

Open anna-geller opened 1 year ago

anna-geller commented 1 year ago

Expected Behavior

Something seems wrong in this part:

https://github.com/kestra-io/plugin-weaviate/blob/master/src/main/java/io/kestra/plugin/weaviate/Delete.java#L101-L106

https://weaviate.io/developers/weaviate/manage-data/delete#delete-multiple-objects

Actual Behaviour

Reproducer: first insert movies

id: weaviate-insert
namespace: dev

inputs:
  - name: weaviateClusterUrl
    type: STRING
    defaults: https://demo-c0geejdk.weaviate.network
  - name: weaviateApiKey
    type: STRING
    defaults: "{{ secret('WEAVIATE_API_KEY') }}"

tasks:
  - id: insertWeaviateMovies
    type: io.kestra.plugin.weaviate.BatchCreate
    url: "{{ inputs.weaviateClusterUrl }}"
    apiKey: "{{ inputs.weaviateApiKey }}"
    className: Movies
    objects:
      - name: "The Shawshank Redemption"
        description: "Over the course of several years, two convicts form a friendship, seeking consolation and, eventually, redemption through basic compassion."
        category: "Drama"
      - name: "The Godfather"
        description: "Don Vito Corleone, head of a mafia family, decides to hand over his empire to his youngest son Michael. However, his decision unintentionally puts the lives of his loved ones in grave danger."
        category: "Crime"
      - name: "The Dark Knight"
        description: "When the menace known as the Joker wreaks havoc and chaos on the people of Gotham, Batman must accept one of the greatest psychological and physical tests of his ability to fight injustice."
        category: "Action"

Steps To Reproduce

now try to delete Shawshank:

id: weaviate-delete
namespace: dev

inputs:
  - name: weaviateClusterUrl
    type: STRING
    defaults: https://demo-c0geejdk.weaviate.network
  - name: weaviateApiKey
    type: STRING
    defaults: "{{ secret('WEAVIATE_API_KEY') }}"

tasks:
  - id: deleteWeaviateMovie
    type: io.kestra.plugin.weaviate.Delete
    url: "{{ inputs.weaviateClusterUrl }}"
    apiKey: "{{ inputs.weaviateApiKey }}"
    className: Movies
    filter:
      name: "The Shawshank Redemption"

success is false, nothing got deleted: image

Environment Information

Example flow

No response

shrutimantri commented 7 months ago

This also doesn't work if no filter is provided. If no filter is provided, all the objects of the className should be deleted. But no object gets deleted.