#community-help

Issues with Non-Indexed Required Fields and Nested Fields Schemas

TLDR Dima questioned why non-indexed fields can't be required and disabled auto-schema for nested fields. Kishore Nallan acknowledged both as potential fixes and asked user to create issues.

Powered by Struct AI
eyes1
Jun 28, 2023 (3 months ago)
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
02:37 PM
Hi team! Why is it impossible to create non-indexed, but required, field?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:38 PM
Historically the required field has always been applied for only those that are part of the index. So if a field is marked as required, it cannot be non indexed.
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
02:40 PM
Got it, thank you
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:41 PM
But we will likely fix it
02:41
Kishore Nallan
02:41 PM
It's a small check we have to remove
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
02:43 PM
It would be great for our case

Also, it is possible to disable auto-schema (?) for nested fields? I have an object field with index: false in the schema and when I add documents in the index, typesense creates nested fields definitions
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:44 PM
Can you please create an issue with a reproduceable example. This sounds like a bug than feature request
eyes1
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
02:52 PM
Could you please take a look: https://gist.github.com/b0g3r/11e51a25a56c3e34859e12585788d4ef

Maybe it’s expected behaviour
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:02 PM
Technically index: false fields should not be added to schema. I presume the same thing works fine for a non-nested field right?
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
03:58 PM
> should not be added to schema
But what about non-indexed required fields? Let me create two issues, one for tracking non-optional non-indexed field and one for unexpected nested fields schema