Resolving Error with Incorrect Field Type during Schema Update
TLDR Samuel encountered an error updating the schema for an existing collection. Kishore Nallan suggested specifying a concrete type, and later found inconsistent data within the collection that caused the error.
5
2
Mar 01, 2023 (9 months ago)
Samuel
10:28 AMRequest failed with HTTP code 400 | Server said: Field
** has an incorrect type.
error when updating schema on already existing collection? I have tried to export data and check for any corrupted fields but wasn't able to find anything wrongKishore Nallan
10:34 AM**
sounds weird. Are you able to share the data directory with me via DM so I can take a look? You can just zip it and share if it's something you are comfortable sharing.Samuel
10:35 AM**
I just recorded it for purpose of sending this message original error is Error: e: Request failed with HTTP code 400 | Server said: Field
properties.WORK.assignee.value has an incorrect type.
Samuel
10:36 AMproperties.WORK.assignee.value
can be null | [] | string[]
Samuel
10:36 AM{
"fields": [
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "properties.WORK.assignee.value",
"optional": true,
"sort": false,
"type": "auto"
}
]
}
Samuel
10:36 AMKishore Nallan
10:40 AMSamuel
10:41 AMSamuel
10:41 AMTypesense v0.24.0
version might be related ?Kishore Nallan
10:42 AMKishore Nallan
10:42 AM1
1
Kishore Nallan
10:52 AM1
Kishore Nallan
11:19 AMauto
--> it must be a concrete type.Kishore Nallan
11:19 AMKishore Nallan
11:22 AMstring[]
--> it should work!Samuel
12:08 PM1
Mar 17, 2023 (9 months ago)
Samuel
08:20 AMSamuel
08:21 AMSamuel
08:21 AMKishore Nallan
08:22 AMSamuel
08:24 AMSamuel
08:24 AMSamuel
09:04 AMKishore Nallan
09:30 AM1
Kishore Nallan
11:25 AMSamuel
11:26 AMSamuel
11:27 AM{
"fields": [
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "properties.WORK.assignee.value",
"optional": true,
"sort": false,
"type": "string[]"
}
]
}
Kishore Nallan
11:34 AM1
Kishore Nallan
11:40 AMproperties.WORK.assignee.value
seems to be an array of objects?Samuel
11:40 AMSamuel
11:41 AM[{
"lastUpdateBy": "KOBQAiHm8eTYmdYDSJtHfnxOBIv1",
"updatedAt": {
"_nanoseconds": 583000000,
"_seconds": 1676508480
},
"value": [
"KOBQAiHm8eTYmdYDSJtHfnxOBIv1"
]
}
,{
"lastUpdateBy": "AJSUE9y9RtZw5BY7AIqafyPHhgT2",
"updatedAt": {
"_nanoseconds": 415000000,
"_seconds": 1675938146
},
"value": [
"AJSUE9y9RtZw5BY7AIqafyPHhgT2"
]
}]
Kishore Nallan
11:41 AM"properties":{
"WORK":{
"assignee":{
"lastUpdateBy":"CWzdjyOShMg4bHeGO4NkJzigLnE2",
"updatedAt":{
"_nanoseconds":660000000,
"_seconds":1678966234
},
"value":[
{
"displayName":"Social media manager",
"id":"Social media manager"
}
]
},
Samuel
11:41 AMSamuel
11:42 AMjq '.properties.WORK.assignee | select(.properties...'
but didn't found that objectKishore Nallan
11:42 AMid
of the bad document along with the error messageKishore Nallan
11:43 AMNR4FCzUQgqjQGtP6Tzzy
Kishore Nallan
11:49 AMobject[]
field. This is a limitation that we have to address.Samuel
11:49 AMSamuel
11:50 AMKishore Nallan
11:50 AMSamuel
11:52 AMstring[]
and I will do the document.insert() which will contain invalid data. Will it get rejected ?Kishore Nallan
11:53 AMKishore Nallan
11:54 AM1
Typesense
Indexed 3015 threads (79% resolved)
Similar Threads
Issue with Field Indexing and Multiple Data Types
Raymond encountered an issue where a field seemed to be indexed twice and hence couldn't be deleted. Jason advised upgrading to a patch version, but the problem remained. Kishore Nallan suspected a race condition and an issue with conflicting data types. An effective solution wasn't achieved.
Issues with Schema Creation and Nested Fields
Sean encountered a problem with schema creation involving auto nested fields. Kishore Nallan suggested checking the API response for errors and adding problematic fields to the schema as optional. Sean confirmed the advice.
Troubleshooting Invalid Field Error in Firestore Document Indexing
Darren receives an error when indexing Firestore documents with empty array in "_grades" field. Jason suggests submitting a bug report and manually setting the schema. The user still experiences issues. Kishore Nallan reproduces the bug, but suggests a solution might exist with an explicit 'string[]' type definition. Further investigation is needed.
Handling Kinesis Stream Event Batching with Typesense
Dui had questions about how to handle Kinesis stream events with Typesense. Kishore Nallan suggested using upsert mode for creation/update and differentiating with logical deletion. After various discussions including identifying and resolving a bug, they finalized to introduce an `emplace` action in Typesense v0.23.
Cold Start Problem with Dynamic Collections
Adrian reported cold start issues with dynamic collections. Jason suggested using wildcard `*` for query_by parameters, upgrading to `0.25.0.rc34`, and clarified conventions. Adrian's issues were resolved but they reported a limitation that will potentially be addressed.