Slackbot
09/22/2023, 3:05 AMKishore Nallan
09/22/2023, 3:08 AMNarayan Acharya
09/22/2023, 5:03 AMNarayan Acharya
09/22/2023, 5:05 AM{
"name": "Company",
"enable_nested_fields": True,
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "persons",
"type": "object[]",
"index": False,
"optional": True,
},
{
"name": "persons.id",
"type": "int64[]"
},
{
"name": "persons.addresses.zip",
"type": "string[]"
}
]
}
When I try to import the following docs typesense complain:
[
{
"id": "131415",
"persons": []
},
{
"id": "789",
"persons": [
{
"id": 1,
"addresses": [{"zip": None}]
},
{
"id": 2,
"addresses": [{"zip": "11112"}]
},
{
"id": 3,
"addresses": [{"zip": "11113"}]
}
]
},{
"id": "1011112",
"persons": [
{
"id": 4,
"addresses": [{"zip": "11111"}]
},
{
"id": 5,
"addresses": [{"zip": "11112"}]
},
{
"id": 6,
"addresses": [{"zip": "11115"}]
}
]
}
]
The errors:
[{'code': 400, 'document': '{"id": "131415", "persons": []}', 'error': 'Field `persons.addresses.zip` has been declared in the schema, but is not found in the document.', 'success': False}]Narayan Acharya
09/22/2023, 5:06 AMpersons.id and persons.addresses.zip as optional but it still complains for the first two docs. Only when I provide all the necessary fields and none of them are None , like in the 3rd case, it works.Kishore Nallan
09/22/2023, 5:08 AMNarayan Acharya
09/22/2023, 5:10 AMKishore Nallan
09/22/2023, 5:10 AM{
"id": "131415",
"persons": []
},Narayan Acharya
09/22/2023, 5:12 AMpersons as optional. Should I instead just use {"id":131415} when there are no persons?Narayan Acharya
09/22/2023, 5:12 AM{"id":131415} this too does not work and still raises the same errorKishore Nallan
09/22/2023, 5:13 AM"addresses": [{"zip": None}]Narayan Acharya
09/22/2023, 5:13 AMKishore Nallan
09/22/2023, 5:13 AMpersons as optional but have explicit child reference which is not marked as optional, so the explicit child field paths get prirority.Kishore Nallan
09/22/2023, 5:14 AM"optional": True, to the child fieldsKishore Nallan
09/22/2023, 5:15 AMNoneNarayan Acharya
09/22/2023, 5:16 AMNarayan Acharya
09/22/2023, 5:21 AMoptional to all nested fields helped. thanks! I’ll figure out how to deal with None