Joao Neves
06/18/2025, 4:26 PM{
"searches": [
{
"query_by": "embedding,navigationCategories_en,navigationCategories_pt,sellerName,brandName",
"group_by": "productId",
"include_fields": "productId,name,calculatedPrice,salePrice,price,image,reviewRatingAvg,reviewsCount,stock,image,preferredVariantId,sku,color_en,color_pt,rewardPercentageOnPublication",
"group_limit": 1,
"prefix": false,
"highlight_full_fields": "none",
"highlight_fields": "none",
"query_by_weights": "0,50,50,10,10",
"vector_query": "embedding:([], alpha: 0.5)",
"rerank_hybrid_matches": true,
"collection": "products",
"q": "*",
"facet_by": "brandName,calculatedPrice,hierarchicalNavigationCategories_en,navigationCategories_en,product_attributes_en.Color,product_attributes_en.Size",
"filter_by": "stock:>0 && hierarchicalNavigationCategories_en:=[Entertainment > Books]",
"max_facet_values": 20,
"page": 1,
"per_page": 20
},
{
"query_by": "embedding,navigationCategories_en,navigationCategories_pt,sellerName,brandName",
"group_by": "productId",
"include_fields": "productId,name,calculatedPrice,salePrice,price,image,reviewRatingAvg,reviewsCount,stock,image,preferredVariantId,sku,color_en,color_pt,rewardPercentageOnPublication",
"group_limit": 1,
"prefix": false,
"highlight_full_fields": "none",
"highlight_fields": "none",
"query_by_weights": "0,50,50,10,10",
"vector_query": "embedding:([], alpha: 0.5)",
"rerank_hybrid_matches": true,
"collection": "products",
"q": "*",
"facet_by": "hierarchicalNavigationCategories_en",
"filter_by": "stock:>0",
"max_facet_values": 20,
"page": 1
}
]
}Alan Martini
06/18/2025, 4:49 PMgroup_by operations. Because of that, we strongly recommend upgrading your cluster.
Additionally, you're performing several CPU-intensive operations simultaneously: faceting on multiple fields, using group_by, running vector searches, and applying an AND condition in filter_by. Given this combination, high CPU usage is expected.
One optimization you can try is setting the following parameter:
facet_sample_threshold: 1000
Also, consider updating your collection schema by adding range_index: true to the stock field for better performance.Joao Neves
06/18/2025, 5:12 PMAlan Martini
06/18/2025, 5:57 PMJoao Neves
06/18/2025, 6:13 PMJoao Neves
06/18/2025, 6:15 PMAlan Martini
06/18/2025, 6:22 PMJoao Neves
06/18/2025, 6:33 PMAlan Martini
06/18/2025, 7:11 PMembedding-cache-num-entries with an value like 5000.
On the InstantSearch question, for using cache with InstantSearch you'll want to set it when defining the TypesenseAdapter instance, as explained here:
https://github.com/typesense/typesense-instantsearch-adapter?tab=readme-ov-file#caching
Finally, I missed saying that the facet_sample_threshold parameter also needs the facet_sample_percent to be set! So the parameters would be:
facet_sample_threshold: 1000,
facet_sample_percent: 20
Let me know if you need help with any of theseJoao Neves
06/18/2025, 9:10 PMAlan Martini
06/18/2025, 9:11 PM