Georgi Nachev
12/02/2025, 8:14 AMHarpreet Sangar
12/02/2025, 9:13 AMGeorgi Nachev
12/02/2025, 9:35 AM{
"name": "products",
"enable_nested_fields": true,
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "name",
"type": "string",
"sort": true,
"locale": "your-locale"
},
{
"name": "description",
"type": "string",
"locale": "your-locale",
"optional": true
},
{
"name": "bundle",
"type": "bool",
"facet": true
},
{
"name": "vendor",
"type": "string",
"locale": "your-locale",
"optional": true
},
{
"name": "categories",
"type": "string[]",
"locale": "your-locale"
},
{
"name": "category_properties",
"type": "object[]",
"locale": "your-locale"
}
]
}
{
"name": "variants",
"enable_nested_fields": true,
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "name",
"type": "string",
"sort": true,
"locale": "your-locale"
},
{
"name": "url_handles",
"type": "string[]",
"locale": "your-locale"
},
{
"name": "description",
"type": "string",
"locale": "your-locale",
"optional": true
},
{
"name": "vendor",
"type": "string",
"locale": "your-locale",
"optional": true
},
{
"name": "categories",
"type": "string[]",
"locale": "your-locale"
},
{
"name": "category_properties",
"type": "object[]",
"locale": "your-locale"
},
{
"name": "item_id",
"type": "string",
"facet": true
},
{
"name": "price",
"type": "int32",
"optional": true
},
{
"name": "created_at",
"type": "int32"
},
{
"name": "category_ids",
"type": "int32[]",
"facet": true
},
{
"name": "vendor_id",
"type": "int32",
"optional": true,
"facet": true
},
{
"name": "new",
"type": "bool",
"facet": true
},
{
"name": "featured",
"type": "bool",
"facet": true
},
{
"name": "sale_.*",
"type": "bool",
"facet": true
},
{
"name": "product_to_discount_.*",
"type": "int32",
"optional": true
},
{
"name": "sort_price_.*",
"type": "int32",
"optional": true,
"facet": true
},
{
"name": "collection_ids_.*",
"type": "int32[]",
"facet": true
},
{
"name": "brand_model_.*",
"type": "int32[]",
"facet": true
},
{
"name": "tag_ids",
"type": "int32[]",
"facet": true
},
{
"name": "product_type",
"type": "string",
"facet": true
},
{
"name": "category_properties_.*",
"type": "int32[]",
"facet": true
},
{
"name": "parameters_.*",
"type": "int32",
"optional": true,
"facet": true
},
{
"name": "enable_sell",
"type": "bool",
"sort": true
},
{
"name": "url",
"type": "string",
"index": false
},
{
"name": "image",
"type": "string",
"index": false
},
{
"name": "image_id",
"type": "int32",
"optional": true,
"index": false
},
{
"name": "sku",
"type": "string",
"optional": true,
"locale": "your-locale"
},
{
"name": "barcode",
"type": "string",
"optional": true,
"locale": "your-locale"
},
{
"name": "property_1",
"type": "string",
"optional": true,
"locale": "your-locale"
},
{
"name": "property_2",
"type": "string",
"optional": true,
"locale": "your-locale"
},
{
"name": "property_3",
"type": "string",
"optional": true,
"locale": "your-locale"
},
{
"name": "quantity",
"type": "float",
"optional": true
},
{
"name": "total_reviews",
"type": "int32",
"optional": true
},
{
"name": "average_rating",
"type": "float",
"optional": true,
"facet": true
},
{
"name": "order_by_sale_.*",
"type": "int64",
"sort": true
},
{
"name": "order_by_featured_.*",
"type": "int64",
"sort": true
},
{
"name": "order_by_id",
"type": "int64",
"sort": true
},
{
"name": "sort_order",
"type": "int64",
"sort": true,
"optional": true
},
{
"name": "order_by_random",
"type": "int64",
"sort": true
}
],
"default_sorting_field": "order_by_id"
}
{
"name": "categories",
"enable_nested_fields": true,
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "parent_id",
"type": "int32",
"optional": true
},
{
"name": "name",
"type": "string",
"sort": true,
"locale": "bg"
},
{
"name": "url",
"type": "string",
"index": false
},
{
"name": "image",
"type": "string",
"index": false
}
],
"default_sorting_field": "name"
}
{
"name": "vendors",
"enable_nested_fields": true,
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "name",
"type": "string",
"sort": true,
"locale": "bg"
},
{
"name": "url",
"type": "string",
"index": false
},
{
"name": "image",
"type": "string",
"index": false
}
],
"default_sorting_field": "name"
}
Hi Harpreet, thanks for the help!
Here is more context about my use case:
• We have two main searchable collections: products and variants.
• Variants belong to products (via item_id), and the UI requires filtering, grouping, and sorting on the variants collection, while still allowing full-text search on product fields (name, description, categories, vendor.name etc.).
• Grouping is done by item_id and optionally by dynamic parameters_* fields.
• The number of documents ranges from tens of thousands up to millions in each collection.
My goal is:
• Use the variants collection for filtering/sorting/grouping
• But also allow text search across product-level fields (product name, description, vendor, category, etc.)
Given this structure, do you recommend:
1. Denormalizing product fields into each variant (name, description, categories, vendor name),
2. or
3. Using multi-step search (e.g., search products first → filter variants by product IDs)?
Which approach would scale better at “tens of thousands → millions” of documents?
Thanks again!Georgi Nachev
12/03/2025, 8:50 AMHarpreet Sangar
12/03/2025, 9:01 AMGeorgi Nachev
12/03/2025, 9:09 AMHarpreet Sangar
12/03/2025, 9:10 AMHarpreet Sangar
12/03/2025, 9:11 AMHarpreet Sangar
12/03/2025, 9:13 AMKishore Nallan
12/03/2025, 9:15 AMHarpreet Sangar
12/03/2025, 9:17 AMGeorgi Nachev
12/03/2025, 9:19 AMHarpreet Sangar
12/03/2025, 9:19 AMGeorgi Nachev
12/03/2025, 9:20 AMGeorgi Nachev
12/03/2025, 11:35 AMvalidate_field_names: false, I get the error:
"Could not parse the filter query: unbalanced && operands."
How can I avoid this? Creating explicit parameters_N fields for each parameter is not a feasible option because they are very dynamic and the schema would have to be constantly updated.
Thanks for any guidance!Harpreet Sangar
12/03/2025, 11:36 AMfilter_by parameterGeorgi Nachev
12/03/2025, 11:38 AM"q" => "yellow"
"query_by" => "name,short_description,description,categories,vendor,property_1,property_2,property_3,sku,barcode,category_properties"
"filter_by" => "active:=true && draft:=false && hidden:=false"
"per_page" => 9
"page" => 0
"highlight_start_tag" => "<mark>"
"highlight_end_tag" => "</mark>"
"snippet_threshold" => 30
"exhaustive_search" => false
"use_cache" => false
"cache_ttl" => 60
"prioritize_exact_match" => true
"enable_overrides" => true
"highlight_affix_num_tokens" => 4
"prefix" => true
"validate_field_names" => false
"group_by" => "item_id,parameters_57,parameters_59,parameters_60"
"group_limit" => 1
"query_by_weights" => "10,2,2,5,5,5,5,5,5,5,5"
"collection" => "4793_products_variants"
"include_fields" => "id,name,description,price,sale_2,sort_price_2,url,image,barcode,sku,category_properties,categories,brand_model"
]
if i change group_by to has only item_id, the problem is goneHarpreet Sangar
12/03/2025, 11:42 AMGeorgi Nachev
12/03/2025, 11:43 AM30.0.rc11Harpreet Sangar
12/03/2025, 11:45 AMGeorgi Nachev
12/03/2025, 11:45 AMGeorgi Nachev
12/03/2025, 11:49 AM30.0.rca33Georgi Nachev
12/03/2025, 11:49 AMHarpreet Sangar
12/03/2025, 11:49 AMGeorgi Nachev
12/03/2025, 11:52 AMGeorgi Nachev
12/03/2025, 11:53 AM