#community-help

Storing Product Variations in Typesense

TLDR Mjerjawi inquired about storing product variations in Typesense, and Jason responded that Typesense currently does not support nested fields. Mjerjawi thanked him and hoped for future updates.

Powered by Struct AI
eyes1
4
21mo
Solved
Join the chat
Dec 12, 2021 (21 months ago)
Mjerjawi
Photo of md5-acabeb270eee485e29143a208813eecc
Mjerjawi
08:32 PM
Hello everyone, First I want to thank the maintainers for this Great Project! I like how easy and powerful typesense is, would like to ask if it is possible to store and faced different products variations like this example
[
    {
        "name": "some tv",
        "brand": "some tv brand",
        "category": "televisions",
        "variations": {
            "size" : 55,
            "type" : "LED",
            "resolution": "1920x1080"
        }
    },
    {
        "name": "some phone",
        "brand": "some phone brand",
        "category": "smartphones",
        "variations": {
            "memory" : "8 GB",
            "battery" : "5000mah",
            "color": "red"
        }
    },
    {
        "name": "some keyboard",
        "brand": "some keyboard brand",
        "category": "keyboards",
        "variations": {
            "connection" : "USB",
            "type" : "gaming",
            "features": "backlit"
        }
    }


] 
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
08:51 PM
Mjerjawi Typesense doesn’t support nested fields at the moment. So you would have to flatten nested fields into top level keys. In your case, you would have to create a separate record for each product variation
eyes1
Dec 13, 2021 (21 months ago)
Mjerjawi
Photo of md5-acabeb270eee485e29143a208813eecc
Mjerjawi
04:16 PM
Jason Thank you very much for your reply, I will work around that, I hope nested fields support comes in future updates 😀
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:38 PM
Yup nested fields support is planned for the near future