Hey everyone, I am struggling with JOINs in my col...
# community-help
b
Hey everyone, I am struggling with JOINs in my collections. Hope you guys can help. I have a big
contacts-2024-10-10
collection with about 25k records and a
contacts
alias pointing to it. I also have an empty
packages-2024-11-15
collection with a
packages
alias pointing to it. I now want to add a
contactId
field inside
packages-2024-11-15
that references
contacts
Copy code
{
  "fields": [
    {
      "name": "contactId",
      "type": "string",
      "reference": "contacts.id"
    }
  ]
}
As per the docs it should be possible to use aliases in those fields. The first issue I have is that
contactId
never shows up in the final schema. There does seem to be something hidden, though. If I now try to index my first package (with a valid
contactId
), I am getting the error message
Copy code
"Request failed with HTTP code 400 | Server said: Field `contactId_sequence_id` has been declared in the schema, but is not found in the document."
Obviously, I am not setting that
contactId_sequence_id
field myself when sending a document. Isn't that supposed to happen automatically? I currently have to manually drop that
contactId_sequence_id
field from the schema to be able to at least index my packages without foreign keys. What am I missing here? Thank you for your help
I'm on Typesense v27.1
k
We don't support adding reference fields via alter API.
b
Oh, so I have to makes sure to add this field right when I create the collection?
Oh my, second sentence in the docs 🙈.
k
Sorry, I know it's annoying. We're still working on making references work with all parts of Typesense. It's a large under taking so we are proceeding step by step.
b
No worries. I'm glad there's a solution by just creating the collection from scratch. Thanks for all the great work. Typesense is helping us so much in our product ❤️
🙌 2