Hi there - we are building a collection that store...
# community-help
s
Hi there - we are building a collection that stores info on "projects" and projects can have multiple members{ID, Username, Role}. Since currently nested fields are not indexed we are a little stuck on what the flattened structure would look like? @Jason Bosco
j
@Sachin Singh Could you share what your current nested structure looks like in JSON? I can then suggest a flattened structure
s
Example of json: {    id:"8d6250fd-cac3-47dc-b084-210dd67b4698",    workspaceId:"8d6250fd-cac3-47dc-b084-210fdd9b4698",    workspaceName:"workspaceName",    description:"description",    status:"ACTIVE",    projectMembers:[        {            userId:"8d6250fd-cac3-47dc-b084-210fdd9b4698",            userName:"testusername",            image:"image.png"        },        {            userId:"8d6250fd-cac3-47dc-b084-210fdd9b4698",            userName:"testusername",            image:"image.png"        },        {            userId:"8d6250fd-cac3-47dc-b084-210fdd9b4698",            userName:"testusername",            image:"image.png"        },    ],    brandName:"brandName",    brandDescription:"brandDescription",    brandUrl:"Https://google.com",    brandIndustryName:"brandIndustryName", }
@Jason Bosco
c
I would convert that into a collection of arrays, e.g.
member.userID: string[]
,
member.userName: string[]
🙌 1
although you may only need userID to be searchable, and included in the schema (i.e. you get name + image back in results, but don't need them to be indexed)
j
@Sachin Singh ^ exactly what @CaptainCodeman said
You only need to flatten the items that you want to search / filter / facet by and add them to the schema. You can still send nested fields in the document and use that for rendering for eg, image
🙌 1