Julian
07/30/2025, 8:21 AMobject[]
as facet? My data looks like the following (example):
"nutritionalValues": [
{
"field": "dietaryFiber",
"perPortion": 4.43,
"unit": "g"
},
{
"field": "protein",
"perPortion": 10.65,
"unit": "g"
},
{
"field": "energyCal",
"perPortion": 366,
"unit": "kcal"
},
...
]
Now I want to range-facet e.g. by energyCal
.
My plan b is to extract the relevant property from the array and make it a top-level field. But this would mess up my data model a bit so I am looking for another way to achieve this.Kishore Nallan
07/30/2025, 12:08 PMenergyCal
is a value here, so it can't be defined as a facet field.
So you can facet on nutritionalValues.perPortion
and use facet_return_parent=nutritionalValues.perPortion
to make the parent object of that value be returned in the response, which you can use for rendering on the UI.Julian
07/30/2025, 12:20 PMnutritionalValues
as field:
{
name: 'nutritionalValues',
type: 'object[]',
optional: true,
}
I am guessing it's not done by setting the facet: true
flag on the field?Kishore Nallan
07/30/2025, 12:29 PMnutritionalValues.perPortion
Julian
07/30/2025, 12:32 PMKishore Nallan
07/30/2025, 12:34 PMKishore Nallan
07/30/2025, 12:37 PMJulian
07/30/2025, 12:39 PM