Ivy Malao
05/09/2023, 9:20 PM{
storeName: "Best Slice Shop"
products: [{
id: 123,
name: pizza,
ingredients: ["Tomatoes", "Garlic", ... ]
}
]
But it looks like I can only define types on one layer deep (ref https://github.com/typesense/typesense/issues/227#issuecomment-1364072388), e.g.
{
"enable_nested_fields": true,
"name": "store",
"fields": [
{
"name": "products",
"type": "object[]"
},
{
"name": "products.id",
"type": "int[]"
},
{
"name": "products.name",
"type": "string[]"
},
{
"name": "products.ingredients",
"type": "string[][]" <-- doesn't work
}
]
}
Is there a way to define a field to be list of strings on an list of objects field?
Thank you!!Jason Bosco
05/09/2023, 9:22 PM{
"name": "products.ingredients",
"type": "string[]"
}
Jason Bosco
05/09/2023, 9:23 PMJason Bosco
05/09/2023, 9:23 PMJason Bosco
05/09/2023, 9:24 PM{
"enable_nested_fields": true,
"name": "store",
"fields": [
{
"name": "products",
"type": "object[]"
},
]
}
then index one of your documents and then look at the updated collection schema which Typesense generates and check the field type for products.ingredients
?Ivy Malao
05/09/2023, 9:41 PM{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "products.ingredients",
"optional": true,
"sort": false,
"type": "string[]"
},
[ { "id": "123", "ingredients": [ "Tomatoes", "Garlic" ], "name": "pizza" } ]
Jason Bosco
05/09/2023, 9:42 PMproducts
and products.ingredients
explicitly listed, then products will take precedence and index all nested fieldsIvy Malao
05/09/2023, 9:46 PM