We're updating our infra to do regularly scheduled...
# community-help
g
We're updating our infra to do regularly scheduled batch updates of data to typesense to reduce the likelihood that we overload our cluster. For adding data that is simple enough (use import), but I'm wondering what the best way to bulk delete documents is. It looks like I can delete by query, but if I remember correctly, typesense doesn't support OR queries, so there is no way to issue a request like this ("pseudocode"):
DELETE id:1 OR id:2 OR id:3
is that correct? is there some other way to achieve a bulk delete?
k
If your collection has a numerical field, then you can issue a query like
field:>= 0
which will cover all records and delete them.
g
I want to bulk delete specific documents
not wipe the entire collection
k
Then
[0, 1, 2]
is the OR notation
I've to check if we allow the
id
to be targeted that way but it will certainly work if you have another ID-like field.
g
gotcha,
filter_by=id:[1,2,3]
?
k
Yes
g
cool, yes I assumed this requires me to index
id
but if I can do it without indexing, even better!
k
I just looked. We have to add direct support for using the ID field without an explicit index. Can you please create a github issue for tracking?
But it might just be consistent to require indexing ID field.
So there is no special case that someone has to remember.
g
I'll create an issue. I can imagine it being nice to bulk delete by id out of the box, but I'll index for now.
👍 1
ty 1
o, one last question
is there a limit
to number of ids I can pass in that array?
k
We impose a 4K char limit on the GET params sent. We might have to support DELETE request body to overcome this limitation.
But 4K is plenty if you intend to batch.
g
kk good to know, thanks!
issue here