Seeing very weird behavior of nested fields in bot...
# community-help
e
Seeing very weird behavior of nested fields in both 0.25.0rc34 and rc54, it seems to be confused on field types. With the following schema:
Copy code
{
  "name": "anime:production@42069",
  "enable_nested_fields": true,
  "fields": [
    {
      "name": "titles",
      "type": "object"
    },
    {
      "name": "titles\\..*",
      "type": "string"
    },
    {
      "name": "start_date",
      "type": "object"
    },
    {
      "name": "start_date\\..*",
      "type": "int32",
      "facet": true,
      "optional": true
    }
  ]
}
I attempt to insert the following:
Copy code
{
  "titles": {
    "zh-cn": "我的英雄学院"
  },
  "id": "420",
  "start_date": {
    "year": 2020,
    "month": 2,
    "day": 3
  }
}
And get the following error:
Copy code
{
  "message": "Field `titles.zh-cn` must be an int32."
}
Even though I clearly defined
titles\..*
to be
string
🤔
Perhaps notable is that removing the definitions for
start_date
and
start_date\..*
resolves it, even though they definitely do not match the field
k
👋 That's a very odd issue. I'll take a look at this. Can you please create a Github issue just capturing the above example? Will be useful to track it. Thanks.
e
will do!
k
Also, for indexing mandarin, you should set the
locale
property of the field to
zh
e
Indeed, I do that too, I’ve got a bunch of field definitions for
.*\.zh.*
which define locales, but I reduced this testcase and happened to choose the mandarin field when doing so 😅 Still happens even with english, I’ll change that in the github issue
k
Yes got it, this is unrelated to the type issue. Just wanted to make sure you were aware of the locale property. I will get back to you with what's happening here.
e
I mention this in the issue, but I want to note here too: the
start_date
field alone is fine, it’s the
start_date\..*
field which breaks it
k
👍
e
I’ve worked around this for now by just declaring the
day
month
and
year
fields explicitly, thankfully that works for my use case 😅