Matheus Bombonato
05/21/2025, 3:15 PMMatheus Bombonato
05/21/2025, 3:25 PMKishore Nallan
05/22/2025, 6:31 AMI have a 10 million records collection and I'm getting about 600ms for a regular search.Can you post your search query parameters? Maybe I can suggest a way to optimize the query.
Matheus Bombonato
05/22/2025, 2:42 PM{ "searches": [{
"collection": "skus",
"query_by": "sku_name,product_name",
"q": "*",
"per_page": 10,
"include_fields": "product_id,sku_id,seller_id,sku_name,product_name",
"filter_by": "$offers(offer_active:=true && clusterId:=['null','abd-1234'] && paymentFormId:!='null') && seller_id:=['670972463814f3334d650c74','66a9981f9e6d8686ba64a3f3']"
}]}
"search_time_ms": 417
And I have this scenario which is very weird. This query should be very fast right? it's very simple and I just want to get 10 active offers.
{ "searches": [{ "collection": "offers", "q": "*", "per_page": 10, "filter_by": "offer_active:true" }]}
"search_time_ms": 1974
Kishore Nallan
05/22/2025, 2:45 PMThis query should be very fast right? it's very simple and I just want to get 10 active offers.This is a wildcard query so has to search through all the records if the filter clause matches most products.
Kishore Nallan
05/22/2025, 2:46 PMfoo: bar
syntax rather than foo:= bar
syntax. The later syntax requires more cpu to compute exact match. If the IDs are fixed length, like SHAs, you can just drop the =
Matheus Bombonato
05/22/2025, 2:56 PM=
from the first query. The search time is basically the same.Matheus Bombonato
05/22/2025, 2:57 PMMatheus Bombonato
05/22/2025, 3:12 PMKishore Nallan
05/22/2025, 3:15 PMsplit_id: foo
doesn't help? Within the same collection.Matheus Bombonato
05/22/2025, 3:36 PM{ "searches": [{
"collection": "skus",
"query_by": "sku_name,product_name",
"q": "*",
"per_page": 10,
"include_fields": "product_id,sku_id,seller_id,sku_name,product_name",
"filter_by": "$offers(offer_active:=true && clusterId:=['null','abd-1234'] && paymentFormId:!='null' && seller_id:=['670972463814f3334d650c74','66a9981f9e6d8686ba64a3f3']) && seller_id:=['670972463814f3334d650c74','66a9981f9e6d8686ba64a3f3']"
}]}
"search_time_ms": 370