#community-help

Resolving Document Upsert Error

TLDR S had an error while trying to upsert a document. Kishore Nallan suggested using a different build (0.12.0 rcs13). Issue was resolved but S had other issues relating to "id" usage and INI file parsing, awaiting Kishore Nallan response for these.

Powered by Struct AI

1

12
25mo
Solved
Join the chat
Oct 10, 2021 (25 months ago)
S
Photo of md5-7d2796ababc14477f4c09abc2e8edb05
S
10:58 AM
I am getting an error when upserting a document (codeblock #1) into a collection field (codeblock #2). I am sure I am missing something very obvious. Can you see my mistake?

# document being upserted
{
    ...
    "mobilities_stringarr_yesindex_nofacet": [],
    ...
}```
# collection field
{
"facet": false,
"index": true,
"name": ".*_stringarr_yesindex_nofacet",
"optional": true,
"type": "string[]"
},

# the error
{
"message": "Type of field mobilities_stringarr_yesindex_nofacet is invalid."
}```
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:59 AM
👋 What error are you getting?
S
Photo of md5-7d2796ababc14477f4c09abc2e8edb05
S
11:01 AM
Sorry, I sent the message prematurely due to me thinking <Enter> would create a breakline instead of sending the message.
I have added it now.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:02 AM
I think I fixed a variation of this issue involving an empty array and a field name with regex recently. Do you use Docker?
11:03
Kishore Nallan
11:03 AM
I can share a build for you to try against.
S
Photo of md5-7d2796ababc14477f4c09abc2e8edb05
S
11:03 AM
Yes, I use Podman 🙂
Shall I use an rc?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:03 AM
Yes, can you please use 0.12.0 rcs13 ?
11:03
Kishore Nallan
11:03 AM
If it still fails, I will be happy to dig further.
S
Photo of md5-7d2796ababc14477f4c09abc2e8edb05
S
11:03 AM
Thank you, I will report back and try <https://hub.docker.com/layers/typesense/typesense/0.22.0.rcs13/images/sha256-4957b3da9ad910bed57470a742c6eb8058566c9887d9156d4b726800eb2ec2af?context=explore|0.22.0.rcs13>

1

09:01
S
09:01 PM
It worked 🎉
09:14
S
09:14 PM
Though I have come across two surprises when running 0.22.0.rcs13. I suspect some not being specific to the RC but to TS in general, and it's very likely I may have fat fingered something. I am happy to provide more debug details if any of these points interest you.

• I suspect this issue to be new to 0.22: I cannot do query_by: id (anymore)
Collection schema cannot contain a field with name id. Ignoring field.

• I suspect this issue to be general to TS, or only the ini-parser. Max length for the master token is approx. 128, this is not documented. 'config file cannot be parsed' warning occurs in logs, limitation may hypothetically not be present when using env vars
Oct 11, 2021 (25 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:37 AM
1. Because 'id' is a special field and it caused some edge cases / confusion about what it can and cannot do we have decided not to allow a field to be named "id" in the schema. To query a document of a specific ID you can either do a wildcard query and filter_by id or use the /collections/: collection/documents/:id endpoint.

2. Can you post a sample INI file here that I can test locally?