hi. I am uisng below typesense schema . but after...
# community-help
p
hi. I am uisng below typesense schema . but after import typesense is changing the the schema for nested field in array of strings. when i manually try changing it back to int64 or string for max_number or feature_name respectively it says Schema change is incompatible with the type of documents already stored in this collection. Existing data for field
property_features.number
has an incorrect type. Hint: field inside an array of objects cannot be coerced into an array type as well.
Copy code
[
                            'name' => 'property_features',  // Nested object for features
                            'type' => 'object[]',
                            'optional' => true,
                            'facet' => true,
                            'fields' => [
                                [
                                    'name' => 'feature_name',
                                    'type' => 'string',
                                    'facet' => true,
                                    'optional' => true,
                                ],
                                [
                                    'name' => 'number',
                                    'type' => 'int64',  // Adjust type if number is not integer
                                    'facet' => false,
                                    'optional' => true,
                                ],
                                [
                                    'name' => 'max_number',
                                    'type' => 'int64',  // Adjust type if max_number is not integer
                                    'facet' => false,
                                    'optional' => true,
                                ],
                                [
                                    'name' => 'feature_options',  // Assuming JSON string for selected options
                                    'type' => 'string[]',
                                    'optional' => true,
                                    'facet' => true,
                                ],
                            ],
                        ],
f
Hey there. I couldn't exactly get what the problem here is. That error will be returned in a schema update operation. Could you provide a reproducible example of a couple of curl commands + a small subset of your dataset so we can a closer look?
p
hi @Fanis Tharropoulos actually i my typesense schema data type for max_number, number, feature_name all are coming as array. though i have below in laravel.
Copy code
public function toSearchableArray()
    {

        $features = [];
        foreach ($this->propertyPropertyTypeFeatures as $propertyFeature) {
            if($propertyFeature){
                $features[] = [
                    'feature_name' => (string)$propertyFeature->propertyTypeFeature->name, // Keep for efficiency
                    'number' => (int)($propertyFeature->number ?? 0),
                    'max_number' => (int)($propertyFeature->max_number ?? 0),
                    'feature_options' => $propertyFeature->selected_feature_types,
                ];
            }
            else{
                $features = null;
            }
        }

        $amenities = $this->propertyAmenities->pluck('name')->toArray();
        $updatedAt = $this->updated_at->timestamp;

        return array_merge($this->toArray(), [
            'id' => (string) $this->id,
            'title' => $this->title,
            'property_type_name' => $this->propertyType->name,
            'property_features' => $features,
            'property_amenities' => $amenities,

            'updated_at' => $updatedAt,

        ]);
    }


    And i have below in scout.php for Property model

    [
        'name' => 'property_features',  // Nested object for features
        'type' => 'object[]',
        'optional' => true,
        'facet' => true,
        'fields' => [
            [
                'name' => 'feature_name',
                'type' => 'string',
                'facet' => true,
                'optional' => true,
            ],
            [
                'name' => 'number',
                'type' => 'int64',  // Adjust type if number is not integer
                'facet' => false,
                'optional' => true,
            ],
            [
                'name' => 'max_number',
                'type' => 'int64',  // Adjust type if max_number is not integer
                'facet' => false,
                'optional' => true,
            ],
            [
                'name' => 'feature_options',  // Assuming JSON string for selected options
                'type' => 'string[]',
                'optional' => true,
                'facet' => true,
            ],
        ],
    ],
Below is the schema for i have