Adding new field to a collection issue in Typesense
TLDR Ankit receives a 'request malformed' error while adding a new field to a Typesense collection. Kishore Nallan explains the issue is due to schema validation. They advise creating a Github issue for supporting coercion. After Ankit reproduces the issue and shares details, Kishore Nallan acknowledges the issue and promises to investigate.
1
Sep 07, 2023 (2 months ago)
Ankit
10:41 AMtypesense.exceptions.RequestMalformed: [Errno 400] Schema change is incompatible with the type of documents already stored in this collection. Existing data for field `XXX` cannot be coerced into an array of string.
The XXX field in the schema is an object field that isn't indexed and just to show some display values and when adding to it we use coerce_or_drop. Why is another field being coerced when adding a non-related field? What would be the correct way to add a new field without caring about the schema within this object field.
Kishore Nallan
10:42 AMAnkit
10:43 AMKishore Nallan
10:44 AMAnkit
10:44 AMKishore Nallan
10:45 AMKishore Nallan
10:45 AMAnkit
10:46 AMAny plans or a ticket already in place to add a feature to avoid schema validation while doing schema updates on all fields or fields to exclude?
Kishore Nallan
10:49 AMAnkit
10:50 AMAnkit
11:00 AMKishore Nallan
11:10 AMAnkit
11:27 AMIn our schema, XXX is a display object, so we didn't care about the schema much if data is available there we display it. So the keys within the object may be strings, arrays or objects.
Kishore Nallan
11:29 AMAnkit
11:30 AMOnce identified I'll update the issue.
Kishore Nallan
11:30 AMAnkit
05:04 PMSep 08, 2023 (2 months ago)
Kishore Nallan
12:17 AM1
Typesense
Indexed 3011 threads (79% resolved)
Similar Threads
Threading Problem During Multiple Collection Creation and Batch Insertion in Typesense
Johan has a problem with creating multiple collections and batch-inserting documents into Typesense, which is returning results from different collections. Kishore Nallan helps troubleshoot the issue and suggests a potential local race condition, which is fixed in a later build.
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.
Methods for Fetching, Querying, and Modifying Collections in Typesense
Bill inquired about performing OR queries, querying empty arrays and modifying collections in Typesense. Kishore Nallan explained the current limitations and provided workarounds and recommendations for each case. The conversation also touched upon the usage of cache in Typesense and the workings of the _eval function.
Resolving Error with Incorrect Field Type during Schema Update
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.