Creating Schema for Nested Objects in JSON
TLDR Greg asked about creating schemas for nested objects in JSON. Jason provided information about indexing nested fields in Typesense v0.24.0. PneuViz requested details about replacing the 'highlights' field with 'highlight' in the new version.
1
Sep 23, 2022 (13 months ago)
Greg
08:31 PM{
"contributors": {
"contributor1": {
"bio": "Some bio",
"firstName": "John",
"lastName": "Doe",
"type": "author"
},
"contributor2": {
"bio": "Another bio",
"firstName": "Jane",
"lastName": "Joe",
"type": "editor"
},
"contributor3": {
"bio": "An even better bio",
"firstName": "Billy",
"lastName": "Jean",
"type": "influencer"
}
}
}
Greg
08:31 PMGreg
08:33 PM{
"contributors": [{
"bio": "Some bio",
"firstName": "John",
"lastName": "Doe",
"type": "author"
},
{
"bio": "Another bio",
"firstName": "Jane",
"lastName": "Joe",
"type": "editor"
},
{
"bio": "An even better bio",
"firstName": "Billy",
"lastName": "Jean",
"type": "influencer"
}
]
}
Jason
08:35 PMIf you’re running 0.24.0, here’s how to index nested fields: https://github.com/typesense/typesense/issues/227#issuecomment-1211666924
Greg
08:38 PMJason
08:43 PM1
Oct 10, 2022 (12 months ago)
PneuViz
06:30 PMJason
08:21 PMhighlight
which will include highlights for all fields, including nested fields. There should still be a field called highlights
(plural) which lists all highlights for non-nested fields.Typesense
Indexed 2776 threads (79% resolved)
Similar Threads
Duplicate Highlight Keys in Search Results
Manish noticed two highlight keys in search results. Jason explained "highlight" is the newer key for nested fields, while "highlights" is for backward compatibility.
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.
Issues with Highlight Version in Typesense
Stefan reported issues with the new highlight version in Typesense. Kishore Nallan provided a temporary workaround and further fixed the issue with an updated build.
Configuring Typesense Extension for Nested Fields in Firebase Collection
David had issues indexing nested fields using the Typesense extension. Jason offered advice on specifying schemas and prioritizing specific fields, but there remained unresolved challenges with the schema.
Integration Issues with Highlights in Typesense
Michael was struggling with integrating highlights into their work. Dima and Jason offered clarifications and suggestions. Michael decided to try Jason's solution.