Vamshi Aruru
01/02/2025, 8:02 AMcurl -X POST '<http://localhost:8108/collections>' \
-H 'X-Typesense-Api-Key: xyz' \
-H 'Content-Type: application/json' \
-d '{
"name": "product_v2",
"fields": [
{"name": "id", "type": "string", "index": true},
{"name": "productId", "type": "string", "facet": true},
{"name": "productSlug", "type": "string", "index": true},
{"name": "variantID", "type": "string","sort": true},
{"name": "enabled", "type": "string", "index": true},
{"name": "title", "type": "string", "index": true},
{"name": "arrayField.quantity", "type": "int32[]", "index": true, "optional": true},
{"name": "arrayField.size", "type": "string[]", "index": true, "optional": true}
],
"token_separators": ["/"]
}'
and I have ingested the following documents
curl -X POST '<http://localhost:8108/collections/product_v2/documents/import>' \
-H 'X-Typesense-Api-Key: xyz' \
-H 'Content-Type: application/jsonl' \
-d '{"id": "10","productId": "10","productSlug": "slug1", "variantID": "v1", "enabled": "Yes", "title": "Queen/Double", "arrayField": [{"size": "X", "quantity": 10}, {"size": "S", "quantity": 5}]}
{"id": "11","productId": "11","productSlug": "slug1", "variantID": "v2", "enabled": "No", "title": "Queen/Bedsheet", "arrayField": [{"size": "M", "quantity": 0}, {"size": "X", "quantity": 3}]}
{"id": "13","productId": "13","productSlug": "slug2", "variantID": "v3", "enabled": "Yes", "title": "Queen/Large", "arrayField": [{"size": "L", "quantity": 9}, {"size": "S", "quantity": 11}]}
{"id": "14","productId": "14","productSlug": "slug3", "variantID": "v4", "enabled": "Yes", "title": "Queen/Medium", "arrayField": [{"size": "S", "quantity": 8}, {"size": "M", "quantity": 7}]}'
now when I make the following search
curl --location '<http://localhost:8108/collections/product_v2/documents/search?q=*&filter_by=arrayField.size%20%3A%3D%20%5B%60S%60%5D>' \
--header 'x-typesense-api-key: xyz'
I expect to get two documents back, but I am getting zero. Am I doing something wrong here?
Thanks for the help!Kishore Nallan
01/02/2025, 10:47 AMenable_nested_fields: true
Vamshi Aruru
01/02/2025, 10:57 AM