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.
1
Oct 19, 2022 (12 months ago)
Andrew
02:40 PMFor 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
03:30 PMfilter_by=author:!=[JK Rowling,Gilbert Patten]
which will return records which don’t have either of those authors in the array field
Jason
03:30 PMAndrew
03:41 PM1
Typesense
Indexed 2779 threads (79% resolved)
Similar Threads
Excluding Specific Documents in Typesense Results
Alexander asked how to exclude specific documents in Typesense search results, and Jason suggested using the hidden_hits search parameter and multi_search for large lists.
Retrieving Multiple Documents by ID in Typesense
Bruno asked about retrieving multiple documents by ID in Typesense. Jason suggested using `filter_by: id:=` and gave advice on POST requests and order preservation. Bruno successfully implemented these solutions.
Using Typesense to Search Specific Document IDs
Tshepo inquired about performing specific document ID searches in Typesense. Jason advised using the `filter_by=id:=[1,2,3,etc]` function or directly querying Typesense.