Olivier
03/12/2026, 2:41 PM{
"name": "contacts",
"enable_nested_fields": true,
"fields": [
{
"name": "contactname",
"type": "string",
"sort": true,
"facet": true,
"index": true
},
{
"name": "notes",
"type": "string",
"sort": true,
"facet": false,
"index": true,
"optional": true
},
{
"name": "email",
"type": "string",
"sort": true,
"facet": false,
"index": true,
"optional": true
}
}
And contact linked to issues:
{
"name": "issues",
"enable_nested_fields": true,
"fields": [
{
"name": "recordidentifier",
"type": "string",
"index": true
},
{
"name": "contactsdata",
"type": "object[]",
"sort": false,
"facet": false,
"index": true,
"optional": true
},
{
"name": "contactsdata.contactid",
"type": "string[]",
"sort": false,
"facet": false,
"index": true,
"reference": "contacts.id",
"optional": true
}
}
What I observe is a different response when I query issues, with or without a filter on contacts (ie: "filter_by": "$contacts(contactname:Chris*"). With a filter, the "contacts" payload is separated from contactsdata, while without a filter it is embedded within.
With filter:
"contacts": {
"contactname": "Christopher Brown",
"email": "~~"
},
"contactsdata": [
{
"contactid": "51"
}
],
Without filter:
"contactsdata": [
{
"contactid": "51",
"contacts": {
"contactname": "Christopher Brown",
"email": "~~"
},
}
],
Is this expected? Is this controllable?Alan Martini
03/12/2026, 6:01 PM$contacts(contactname:Chris*) , Typesense auto-adds that joined collection to the reference includes with the default nest strategy, so the matched joined doc is attached at the root of the hit as "contacts": {...}. When there is no join filter, Typesense instead follows the stored contactsdata.contactid -> contacts.id object/
object[] reference and injects the joined doc back into the owning object/array element, which produces contactsdata[].contacts.
You can control the top-level join payload with explicit include_fields on $contacts(...) and strategy: nest | nest_array | merge, but that only changes the top-level representation. It does not remap the join at contactsdata[]Olivier
03/13/2026, 8:34 AMHarpreet Sangar
03/20/2026, 4:10 PMI must admit this behavior looks a bit weird to me. My filter is not defining the join, ie: $contact(contactname) is not our joining key. So I guess typesense follows the stored reference in both cases.Typesense shouldn't return the info of related docs if the Join is neither mentioned in
filter_by nor in include_fields.