Does typesense support nearest search on nested fi...
# community-help
m
Does typesense support nearest search on nested field? So for example:
k
Yes you should be able to access nested fields with the dot notation, like
parent.child
m
Copy code
event: {
            name: 'event',
            num_documents: 0,
            enable_nested_fields: true,
            fields: [
                { name: 'title', type: 'string' },
                { name: 'logoUrl', type: 'string', optional: true },
                { name: 'bannerUrl', type: 'string', optional: true },
                { name: 'published', type: 'bool' },
                { name: 'place', type: 'object' },
                { name: 'place.formattedAddress', type: 'string' },
                {
                    name: 'place.location',
                    type: 'geopoint',
                },
                { name: 'place.lat', type: 'float' },
                { name: 'place.lng', type: 'float' },
                { name: 'startAtUnix', type: 'int64' },
                { name: 'startAtUtc', type: 'string' },
                { name: 'startAtLocal', type: 'string' },
                { name: 'endAtUnix', type: 'int64' },
                { name: 'endAtUtc', type: 'string' },
                { name: 'endAtLocal', type: 'string' },
                { name: 'iana', type: 'string' },
            ] as const,
        },
hmm maybe I misconfigured this because I keep getting place.location is not a sortable field?
haha nevermind. Typo inside a sort query. But since I pasted the code above, it is recommended to have { name: 'place', type: 'object'} and also have specific fields listed like { name: 'place.location', type: 'geopoint' } above? I previously went without { name: 'place' , type: 'object' }
k
Having explicit children definitions are useful for fine-tuning the schema, like setting specific properties for only that field.