Querying Unique Field Values in Typesense
TLDR Sruli asked if Typesense could query unique values in a field. SamHendley clarified that facets could be used for this purpose.
Powered by Struct AI
1
4
11mo
Jan 09, 2023 (11 months ago)
Sruli
Sruli
10:52 PMHey, not sure if it’s really possible but is there a way for me to query all the different type of values in a given field, for example if I have a collection of books and they each have a topic but there can be 2 books with the same topic and I want to get a list of all the topics, is that something typesense can do or will I need to make another collection for topics?
SamHendley
SamHendley
10:58 PMthat’s what facets are for
1
10:59
SamHendley
10:59 PMyou can then basically do
facet_by=topic&page_size=0&facet_count=10000
Sruli
Sruli
10:59 PMThank you!!
Typesense
Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI
Indexed 3015 threads (79% resolved)
Similar Threads
Query on Performance with Many Fields in Typesense
John asked about the performance implications of having many fields but only searching on a few in Typesense. Kishore Nallan clarified that all indices are field level and independent.
4
15mo
Understanding Purpose of Facet Fields in Typesense
John sought clarification about the use of facet fields in Typesense. Jason clarified that while previously dataset needed both facet and non-facet fields, this is now redundant.
4
33mo
Faceting and Filtering Issue in Typesense
Hauke faced issues with facets filtering in Typesense. Kishore Nallan recommended using the instantsearch.js JS library or the multi_search endpoint for independent search queries.
12
3mo