#community-help

Issues with Nested Coordinate Fields in Typesense

TLDR Jainil faced issues with nested coordinate fields causing errors, which were fixed in Typesense 0.24.1.rc12 and 0.25.0.rc21 versions.

Powered by Struct AI

3

1

1

Mar 29, 2023 (8 months ago)
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
06:51 PM
Hey all - new to typesense and having issues with nested coordinate fields.
My field is: {"name": "interested_cities.coordinates", "type": "geopoint[]", "optional": True}
And the error I'm getting is:
"error": "Field `interested_cities.coordinates` must contain 2 element arrays: [ [lat, lng],... ].",
06:52
Jainil
06:52 PM
I'm uploading the following:
 "interested_cities": [
    {
      "geoname_id": "2332459",
      "region_geoname_id": "2332453",
      "country_geoname_id": "2328926",
      "coordinates": [
        6.45407,
        3.39467
      ]
    },
    {
      "geoname_id": "1814087",
      "region_geoname_id": "2036115",
      "country_geoname_id": "1814991",
      "coordinates": [
        38.91222,
        121.60222
      ]
    }
  ]
06:52
Jainil
06:52 PM
Any thoughts on what I'm doing wrong? Using v0.24.0
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
07:23 PM
Hi Jainil! It looks like you are using geopoint[] (array type) for only one coordinate. Maybe you want geopoint instead?
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
07:24 PM
If the document can have multiple interested cities, would I still use geopoint?
Dima
Photo of md5-1b62114a658b760944aa7d2b4c274460
Dima
07:25 PM
I’m not using nested fields in my collections, but looks like that :thinking_face:
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
07:25 PM
And followup question, if I have nested fields, should I be defining the type of the outmost nested field as object (or object[]) and then also each field that is nested?
07:29
Jainil
07:29 PM
Hmm Dima - didn't seem to help
Field `interested_cities.coordinates` must be a 2 element array: [lat, lng].
07:35
Jainil
07:35 PM
11:33
Jainil
11:33 PM
CC Jason

FWIW, seems like it has something to do with the
{"name": ".*", "type": "auto"},
11:33
Jainil
11:33 PM
Removing that seems to make it work. Though I'd still like to infer all other fields
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
11:40 PM
I see, good to know!

CC: Kishore Nallan this is on 0.24.0.rc11 ^
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
11:41 PM
(And to be explicit, on 0.24.0 I run into the following, for the same scripts)
Field `interested_cities.coordinates` has an incorrect type.
Mar 30, 2023 (8 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:01 AM
I'm looking into this. Will update.

1

Mar 31, 2023 (8 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:27 AM
Jainil This is fixed in 0.24.1.rc12 -- can you please verify?

1

Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
06:17 PM
Confirmed
06:24
Jainil
06:24 PM
Thank you! Is there an estimated date when this will be available for typesense cloud?
Apr 01, 2023 (8 months ago)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:16 AM
We can upgrade you to this version, if you go to your cluster dashboard > cluster configuration > modify > pick an upgrade window and specify this version
Apr 02, 2023 (8 months ago)
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
07:28 PM
Perfect, thanks!!

1

Apr 04, 2023 (8 months ago)
Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
08:26 PM
To confirm - is the store version for this release candidate 0.24.1 (which was recently released)
Apr 05, 2023 (8 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:25 AM
The fix is part of 0.24.1

1

Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
11:31 PM
FYI Kishore Nallan, I believe the same issue now shows up with geopoint as opposed to geopoint[]
See gist (running on v0.24.1)
https://gist.github.com/jsutaria/4a91640a3449d7dd84bef3ec029783e2
11:32
Jainil
11:32 PM
"Field `current_city.coordinates` has an incorrect type."
11:36
Jainil
11:36 PM
The workaround I'm currently using is just defining the field as a geopoint[]
Apr 06, 2023 (8 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:56 AM
Yikes, I will look
Apr 10, 2023 (8 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:14 AM
Fixed in typesense/typesense:0.25.0.rc21

1

Jainil
Photo of md5-bea1e4531665b4608c47d00462429d3a
Jainil
02:22 PM
Thank you

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3015 threads (79% resolved)

Join Our Community

Similar Threads