#community-help

Trouble with Document Error in Indexing

TLDR Hauke is encountering an error during indexing with a specific field and working to provide Kishore Nallan with a reproducible example. Kishore Nallan gave troubleshooting advice, but issue not yet resolved.

Powered by Struct AI

1

Aug 31, 2023 (1 month ago)
Hauke
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Hauke
08:14 AM
Hello, I'm getting an error while indexing. How do I find out which field is affected?

I20230831 08:13:32.846366    25 index.cpp:504] Error while validating document: [json.exception.type_error.302] type must be number, but is array
I20230831 08:13:33.040822    23 index.cpp:504] Error while validating document: [json.exception.type_error.302] type must be number, but is array
I20230831 08:13:33.574386   111 index.cpp:504] Error while validating document: [json.exception.type_error.302] type must be number, but is array
I20230831 08:13:33.592056    79 index.cpp:504] Error while validating document: [json.exception.type_error.302] type must be number, but is array
I20230831 08:13:35.740233    81 index.cpp:504] Error while validating document: [json.exception.type_error.302] type must be number, but is array
I20230831 08:13:35.773180    53 index.cpp:504] Error while validating document: [json.exception.type_error.302] type must be number, but is array
I20230831 08:13:36.697739    76 index.cpp:504] Error while validating document: [json.exception.type_error.302] type must be number, but is array
08:16
Hauke
08:16 AM
I'm running typesense 0.25.0 in a docker container if that is relevant
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:41 AM
Check the api response. You can also send ?return_id=true parameter so that id of the record is returned.
Hauke
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Hauke
08:44 AM
the API response is just
{
    "message": "[json.exception.type_error.302] type must be number, but is array"
}
08:44
Hauke
08:44 AM
I found the issue by trial and error but I still think it would be helpful if the response contained the offending field name
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:44 AM
That's odd. It seems like the exception happens in an unintended place.
08:45
Kishore Nallan
08:45 AM
Can you please create an example that I can reproduce?
08:45
Kishore Nallan
08:45 AM
The catch all block has no information about what record could have triggered an exception so the error message is generic.
Hauke
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Hauke
08:45 AM
I had an int32[] field that I was trying to feed an array of strings.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:46 AM
Update or new insert?
Hauke
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Hauke
08:47 AM
new insert
08:48
Hauke
08:48 AM
And the strings were strings of numbers so something like
{"intArray": ["2","3"]}
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:48 AM
Ok thanks for the info, I'll check

1

Hauke
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Hauke
08:49 AM
If you need more info to reproduce let me know
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:48 AM
Hauke I just tried to recreate this issue on a simple collection but I get a proper error message:

{"message":"Field `points` must be an array of int32."}                                                                                                                                                     

It will be great if you can post a full example code snippet.
Hauke
Photo of md5-a2785b9d22ba23f3627d4bd877e95e7c
Hauke
11:30 AM
I will try to find a minimal reproducible data set
Sep 01, 2023 (1 month ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:50 AM
Thanks