Troubleshooting Typesense Collection with Nested Objects
TLDR Oskar was encountering problems in creating collections in Typesense with nested objects. Jason advised to ensure that the nested fields are defined as an array. Oskar was able to resolve the issue by rectifying the schema.
Sep 08, 2023 (2 months ago)
Oskar
02:01 PMHowever, I’m seeing some strange behaviour. I’m not able to create a collection with nested object and specify the children of an object that should be indexed.
This works
{
"facet": false,
"index": false,
"name": "sources.*",
"optional": true,
"type": "object"
}
This doesn’t seem to work to have an index on child property of object.
strange behaviour. I'm not able to create a collection
{
"facet": false,
"index": true,
"name": "sources.content",
"optional": true,
"type": "string"
}
Thoughts?
Jason
02:02 PMJason
02:03 PMOskar
02:06 PM> Server said: Field
sources.content
has an incorrect type. Hint: field inside an array of objects must be an array type as well.Oskar
02:06 PMOskar
02:07 PMobject
instead of object[]
.Let me tryOskar
02:12 PM{
"facet": false,
"index": false,
"name": "sources",
"optional": true,
"type": "object[]"
},
{
"facet": false,
"index": true,
"name": "sources.content",
"optional": true,
"type": "string[]"
}
Noticed how the type for
sources.content
needs to be in string[]
Jason
02:47 PMTypesense
Indexed 3011 threads (79% resolved)
Similar Threads
Trouble in Implementing Deeply Nested Search
Anirudh is struggling to implement a two-level nested search. Jason asked for some specific examples to study the issue. Anirudh provided some material, realizing that adding top fields helped but might over-index. Jason then suggested reporting this issue on GitHub.
Defining Nested JSON Schema for Querying
Greg struggled in defining a schema for querying a JSON object with nested fields. Jason offered solutions, with the final resolution involving the use of "object" as a field type for the contributors in the schema.
Faceting Objects in Typesense
John wants to facet objects in Typesense, but faces issues. Kishore Nallan suggests creating a feature request on GitHub.
Troubleshooting Typesense Search in Nested Fields
Vadali couldn't search within nested artist.name field. Kishore Nallan helped diagnose and fix, which involved updating their cloud cluster to a later version. Jason provided advice on using the correct Docker image.
Defining Nested Fields in Typesense Schema
Ivy wanted to define a list of strings in a list of objects, and Jason suggested omitting the explicit field type for "products.ingredients". The schema generated the desired field type.