#community-help

Handling Large Amount of Facet Values

TLDR Dima asked about handling large amounts of facet values. Jason assured that it is fine and suggested setting max_facet_values to a large number.

Powered by Struct AI

1

1

Mar 21, 2023 (9 months ago)
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
08:43 PM
Hi there! What is the best option for a large amount of facet values (like hundreds)?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:15 PM
Do you mean hundreds of fields with faceting enabled in the schema, or do you mean hundreds of field in the facet_by parameter in a single search request?
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
09:17 PM
If I understand you correctly, neither one nor other. I mean facet_counts, i.e. possible values for a facet, like ingredients here:
Image 1 for If I understand you correctly, neither one nor other. I mean `facet_counts`, i.e. possible values for a facet, like ingredients <https://recipe-search.typesense.org/?r%5Bquery%5D=t|here>:
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:18 PM
Ah I see, we call those facet values
09:18
Jason
09:18 PM
Hundreds of facet values is completely fine
09:20
Jason
09:20 PM
What matters is the total number of records, across all facet values for a single search query. When the result of a search query crosses say 10M results, we’ve seen it take a few seconds to compute those facet values…
09:20
Jason
09:20 PM
Are you running into any issues?
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
09:28 PM
I feel uncomfortable to set up max_facet_values to a big number and then get a few kb more with each request :thinking_face: My case is similar to “Brands” here, I have a few hundred thousands of documents and each has association with entity. I don’t really need counts itself, only unique values stored in the field
09:30
Dima
09:30 PM
If I don’t need counts, maybe I can use something like query * + group_by entity + include entity to get all possible values for this field / search trough them? :thinking_face:
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:41 PM
You can only fetch a max of 99 groups though
09:42
Jason
09:42 PM
&gt; set up max_facet_values to a big number
This would be the only way I can think of achieving what you’re trying to do

1

09:42
Jason
09:42 PM
&gt; I have a few hundred thousands of documents and each has association with entity
This should be fine
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
09:47 PM
Got it, thank you

1

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3015 threads (79% resolved)

Join Our Community

Similar Threads

Improving System Performance and Typesense Query Efficiency

SamHendley was experiencing performance issues with Typesense's large-scale system testing and proposed several improvements. Both Jason and Kishore Nallan addressed the suggestions and corrected some misconceptions. They provided further clarification and recommended upgrades for better performance.

9
12mo

Discussion on Retrieving Extra Facet Values

Ricardo inquired about retrieving extra facet values beyond the max_facet_values limit. Kishore Nallan suggested a workaround and asked Ricardo to open a GitHub issue for the feature request.

7
29mo

Querying and Updating Facets in Typesense

Hafiz asked about sum/average of records, hourly grouping, and data formatting in Typesense. Kishore Nallan advised on using `facet_by`, grouping methods, and bulk update options. Hafiz was unable to get sum by group but was advised to store records pre-grouped.

2

31
12mo

Discussions on Typesense, Collections, and Dynamic Fields

Tugay shares plans to use Typesense for their SaaS platform and asks about collection sizes and sharding. Jason clarifies Typesense's capabilities and shares a beta feature. They discuss using unique collections per customer and new improvements. Kishore Nallan and Gabe comment on threading and data protection respectively.

3

45
35mo

Discussing Server Side Cache Limit for Optimising CPU Usage.

Aljosa expressed difficulty benefiting from their server's cache due to varied queries, and suggested a cache limit increase. Kishore Nallan provided potential solutions and agreed to make the cache limit configurable. After adjusting queries, Aljosa saw improved CPU usage.

2

8
22mo