#community-help

Querying TypeSense: Exclude Certain IDs from Array Field

TLDR Andrew asked if it's possible to exclude specific ids from an array in TypeSense, like Firestore's not-in array. Jason confirmed it's possible and shared how to do it, in addition to a reference link.

Powered by Struct AI

1

4
12mo
Solved
Join the chat
Oct 19, 2022 (12 months ago)
Andrew
Photo of md5-7766f890de99fa72a6d81315691a6758
Andrew
02:40 PM
Hey guys, dies typesense have anything like firestore’s not-in array?

For instance, if i have an array of [‘a’, ‘b’], can i run a query where all documents returned do not have an id found in that array?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:30 PM
Yup you can do something like this:

filter_by=author:!=[JK Rowling,Gilbert Patten]

which will return records which don’t have either of those authors in the array field
03:30
Jason
03:30 PM
It’s documented under “filter_by” in this table: https://typesense.org/docs/0.23.1/api/search.html#query-parameters
Andrew
Photo of md5-7766f890de99fa72a6d81315691a6758
Andrew
03:41 PM
Gotcha, ty!

1