any idea how can i batch delete with array of ids
# community-help
s
any idea how can i batch delete with array of ids
k
s
i saw that but couldn't find all the option for the filter_by field
k
You can do
filter_by=field_id:[100, 101, 102]
etc.
s
documents().delete({ 'filter_by=field_id': [1000, 1006] })
gives 400 error, is it right ?
k
What is the error message returned?
s
this
k
It must be like this:
Copy code
client.collections('companies').documents().delete({'filter_by': 'field_id: [1000, 1006]'})
s
SyntaxError: Unexpected token ':' tried to do nest it inside a curly braces too that gives a parse err
k
There was a typo in my earlier snippet, fixed it now.
The example here will work, that's what I am using: https://typesense.org/docs/0.20.0/api/documents.html#delete-by-query
s
Server said: Could not find a filter field named
field_id
in the schema. ...but i didn't add id in schema ..should i ?
k
Yes
s
ohh, i thought i don't need to add ids ...🙃
k
IDs are treated specially and currently not indexed. So you have to add them as an additional field if you want to do this.
👀 1
In future, we will make this easier.
🙏 1